Mapbox GL JS : Live geoJSON overlay - geojson

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.

Related

QnA Maker Manage knowledge - Problem Adding new URL

I have problems adding a new URL when I manage knowledge base in QnAMaker.
I've tried adding this Url but I get the error:
Failed to extract QnAs from the source "URL" - Unsupported / Invalid url(s). Failed to extract Q&A from the source.
I've tested deleting the footer, publishing the page and in this case the URL works properly.
Also, I tested other very similar URLs, like this one and this has been parsed successfully.
What could be the problem?
It would appear that something with the way the questions are encoded on that page is preventing QnAMaker's services from reading the text of the question/answer pairs. In order to get those questions, I was able to copy paste the whole list:
I put them all into a word doc (or equivalent program), and then saved it as a PDF:
Then uploaded this to QnA Maker, where it was able to read the question/answer pairs just fine.
The reason I used a PDF as opposed to a .txt file is so the alternate characters (the Spanish ? for example) would render as well as the bullets from the final question that caused so much grief for the initial renderer.
After left feedback in azure site, QnA Maker Team fixed it. Now, the url is parsed properly.

OpenLayers that is not minified?

I'm trying to find an OpenLayers3.js file that is not minifed, it is a pain debugging stuff that is minified, can anyone help me find it?
Im using this address now: http://openlayers.org/en/v3.0.0/build/ol.js
By the way, it is a special thingy at the top. See the website: http://ol3.js.org/ ? Made me laugh.
Help?
If you need the unminified ol, you can use the one from ol:
http://openlayers.org/en/v3.0.0/build/ol-debug.js
It's a file of 3.5M so don't use this in production ;)
Have you tried the Download link on the main page?
https://github.com/openlayers/ol3/releases/download/v3.0.0/v3.0.0.zip
If you want a hosted version, upload one here:
https://cdnjs.com
Yes, http://openlayers.org/en/v3.0.0/examples/loader.js will load all the raw files -- basically by writing out a bunch of script tags. As #lexicore has already said, you can get the source from github, though this involves setting up nodejs locally to run (which actually isn't that painful, but more so than just debugging from a hosted source). Take a look at package.json to get a feel for how much has gone into OpenLayers 3.
If you go to the OpenLayers 3 examples, for example animation, change production to development in the drop down, and then do view source, you will get the link above. You can also see all the raw js files in the Javascript console.
EDIT: I put some instructions, following the official OL dev page, on how to build/run locally, which will also get you the unminified OL source code

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

Placemark kml info not showing in iOS version of Google Earth

The information for placemarks that I have created in a kml file does
not show on the iPad. The window opens up, but there is no content. It
has worked in the past and it works fine in Google Earth for Windows
and Android. I have a feeling that this might be an issue with Google
Earth on the iPad more than a kml issue.
Here is the file if anybody is interested in taking a look:
http://dl.dropbox.com/u/18240150/GoogleEarthAirports30Apr12.kml
Thanks
Your KML looks good (actually, it's very nicely done; the airports look and behave great):
Visual desk check in a text editor and it looks good
Loaded in Google Earth without problems (confirms the behavior you saw)
Also there is an Interactive KML Parser available online - your KML ran through the parse without errors
Your suspicion that the root cause of your problem lies with the iPad or Google Earth on the iPad appears to be correct. I don't have an iPad, so I can't test that, but knowing that an independent test had similar results at least helps to pinpoint the problem.
Here is a work around for this problem.
Prepare a KML file with NetworkLink tag referring to your remote KML file and download the file.
Then description rendering works well even on iOS5.
"Remote", which means a file places at a server like "http://example.com/sample.kml", is important. Local files like a file in a .kmz file don't work currently.

Resources