Can OpenLayers 3 properly render KML? - openlayers-3

When I used the simple online Demo (http://openlayers.org/en/v3.6.0/examples/drag-and-drop.html), and dropped in a KML file, it got the colors right but it ignored all the placemarks. Using Ubuntu+Chrome.
My needs are pretty basic - I want to make a simple Web page, which allows the user to click one of a number of links, and then render KML corresponding to that link. I would love to use OL3 instead of Google My Maps + Maps, if only because Google appears to require a credit card # etc, for the privilege of using their Javascript API(s).
Thanks!

Have a look at this jsFiddle.
You should be able to drag and drop that example KML file which you provided.
The problem is not the placemarks. Placemarks are fine for OL3. My feeling is that you don't see that data in the other example because the styles are read from the KML. Reading styles from a KML and trying to put this into OL3 opens a whole can of worms.
So I recommend to first use:
formatKML = new ol.format.KML({extractStyles: false});

Related

Add UTM and Referral Links to AR Quick Look

Attempted to track usage of AR content in S3 (without S3).
Am trying to create referral campaign links in PixelMe .
When opening the content it opens an image of the item and and not the content itself.
Here's an example of a pixelme to USDZ link: https://pxlme.me/WnJ8WjY3
Here's an example of a pixelme to GLB link: https://pxlme.me/wK5w0S7G
Here's an example of the embedded iFrame:
<model-viewer style="width:100%;height:100%" src="GLB LINK GOES HERE"
ar auto-rotate camera-controls alt="A 3D model designed by us"
background-color="#FFF" ios-src="USDZ LINK GOES HERE" magic-leap unstable-webxr>
</model-viewer>
When integrating with Google's Model Viewer it says "object could not be opened".
How can I use referral links with AR Quick Look?
The reason something like PixelMe won't work with USDZ and GLB is because Pixelme and any ad targeting/retargeting rely on embedding a line of html into your page that loads a 1x1 pixel image from a remote server.
GLB files are binary files that will serve the images loaded into them. USDZ files are zip files of Pixar's USD format. Neither format supports adding html into it.
If you are looking to track usage of the AR Quick Look use a traditional tool like Google Analytics or any other web analytics tool that can track clicks. The only thing you need to filter for is users running iOS 12+. Any user on iOS 12+ who clicks the link will see the AR Quick Look.

Mapbox GL JS : Live geoJSON overlay

I am working on a weather app in Mapbox and trying to get geoJSON files to update tornado warning polygons live on the map. (This would be done by a file called "warnings.geojson" in the same path as the html file and re-written frequently by a back end c++ app). Anyway, I found the following example on how to update live JSON files :
https://www.mapbox.com/mapbox-gl-js/example/live-geojson/
This works for what it is designed to do (and I understand what it is doing - it is what I am looking for), but I cannot seem to replace the code with my own. I would like to have it update the following test polygon file instead.
https://manidoo.000webhostapp.com/test.geoJSON
The above code is just a polygon of the Bermuda triangle. (Once I get this working, I can modify it on my own) I have tried so many variations of code that listing them here would just be a huge mess. Surely it should very simple and I am just missing it?
I believe what I should be changing is the map.addLayer() function, but I am not sure what to do. Any help would be so greatly appreciated.
The correct answer to my own question was testing the app in the wrong browser. Edge will not show geoJSON polygons that are on a local directory (atleast in this specific scenario). As MeltedPenguin pointed out - the JSON was valid. Once I uploaded my HTML and geoJSON to a server online with a http:// prefix, it worked great. Firefox showed the polygon even in offline mode.

How To Get table of content in Vfr Reader for Pdf in iphone sdk?

I am using VFR reader to display my pdf's. I need to extract the Table of Contents on a button click and display it in a tableview then it should lead to the respective pages while tapping on each.
Parsing the PDF Table of Contents is actually not extremely hard. You can use a tool like Apple's PDF "Voyeur" to see the structure or something like Adobe Acrobat's Preflight Browser:
You see that the "Outline" is a fairly simple tree that can be parsed using the various CGPDF* functions. The challenge here is to also parse the destination/action type. PDF doesn't make things too easy and doesn't give you a page number, instead usually you will find a linked named destination. This can be resolved by cross-referencing another table, it's best to look this up in the PDF spec. This is of course just one of the options, it can also be that the destination is one of the > 10 action types that rage from GoTo over named actions (e.g. Next Page) to JavaScript (e.g. this.pageNum = x). In the image above you see a classical GoTo action with the longer string being the named reference.
There are also some other special cases, notably for older latex documents and some pages from the PDF 1.1 spec that did things a bit differently, so be careful about implementing all corner-cases of the PDF spec to not get surprises later on.
Outlines sometimes also include URI actions, so at least implement that type as well. And they can also have font styles and color, so you won't ever get bored. Been there, done that in our commercial PSPDFKit PDF SDK for iOS and Android.

Rendering PDF in iOS

Need help on rendering PDF using CGPDFContext. I am currently using UIWebView to display PDF but would like to perform much more operation rather than just reading like Highlight Text, Search PDF, Annotate PDF. Not looking for using any Framework or library.
Any help will be beneficial. For a start, code on how to render PDF using CGPDF and displaying it instead of using UIWebView.
PDF annotations are a rabbit hole. I've been working on them since 2010. The spec is thousands of pages. It's easy to get started but it takes forever to get right with all the PDFs and variations out there. Even a simple feature like bookmarks are harder than you would think.
To date there's no open source framework that implements PDF annotations. The above linked one can be a good starting point. If you don't have months/years to build something on your own, there are a few commercial options available - like PSPDFKit, available for iOS, Android and Web, which I am building.
We have a guide article listing the most important PDF spec documents.
Searching is another tricky topic. It's quite hard to convert the PDF text data to unicode. The Adobe CIDFont spec is a good starting point.
You shoud try VFReader, it is an open source project for rendering PDF files on iOS. It can be a good starting point.

Embedded Youtube videos not appearing in infowindows

I am attempting to embed Youtube videos into some of the infowindows in the following KML file:
http://www.jonangfoundation.org/files/newdef.kml .
The videos show up fine on Google Earth and KML Builder, but on this page they do not show up at all:
http://www.jonangfoundation.org/taktentest
Anyone know what could be keeping them from showing up?
Unfortunately your 'test' page does not load - Page Not Found error.
However, I think you need to set the correct MIME type for .kml files. Your newdef.kml is presented in my browser window as XML rather than downloaded as a .kml file. That might be your problem, it is hard to tell with nothing else to go on. check out this link for details about setting the right MIME
https://developers.google.com/kml/documentation/kml_tut#kml_server
Edit: I am not sure what is going on. Your KML code looks okay to me, and I see you have tried a few different approaches, none of which appear to work. I suggest you visit this SO question, as it's answer is something you could do to make it work.
Basically, you override the default behaviour when a placemark gets clicked, and allow iframes and javascript to be used in the balloon. It is the original way of getting around your problem (however I thought it was fixed in recent version of the plug-in. Maybe not?)
I believe your content is being scrubbed. See link for description and possible work around.
https://developers.google.com/earth/documentation/balloons#scrubbing

Resources