Skip to first unread message

Someshvar Vashisht

unread,
Feb 12, 2019, 4:09:09 AM2/12/19
to MIT App Inventor Forum

Hi I'am having problems loading geoJson into featureCollections 

When i use FeatureCollection or Map .LoadFromUrl where the url =http://geojson.io/#map=18/23.24258/56.41976 
It apparently succeds (as so far as the GotFeatures event fires. The Features of the Event are also correct but no features are added to the map or featureCollection  (the features remain a empty list)
If a try to set the featurecollection to a url or a asset with the same content I reserve a 500 internal server error
The question is there any one that has a working working example where loading a geoJson works?

Even if i upload the gejson , it gives "Internal error" which I reported so many times.
My project is stuck...

SteveJG

unread,
Feb 12, 2019, 9:13:37 AM2/12/19
to MIT App Inventor Forum
Works fine.  Did you create a geojson object and save it to your PC then load the Map.geojson in Media?

makeGeojson.PNG

The link tool to create a geogjson file is on the left,  the rendering of the saved Map.geojson is on the right.

Does this help?


Regards,
Steve

Someshvar Vashisht

unread,
Feb 12, 2019, 9:59:17 AM2/12/19
to MIT App Inventor Forum
Yes. geojson file loads in media but when i choose this media in featurescollection , it shows "internal error".

SteveJG

unread,
Feb 12, 2019, 10:03:28 AM2/12/19
to mitappinv...@googlegroups.com
Try loading the attached geojson in Media.  It works on my device   If it does not work, explain how you are linking to the file.  You can do it easily in the Designer properties by setting the file in Media   to   FeatureCollection   Source    Make sure you are using Companion version 2.51 .
map.geojson

Someshvar Vashisht

unread,
Feb 12, 2019, 10:35:52 AM2/12/19
to MIT App Inventor Forum
hi Steve!
This is how did it.Just made a video and sending u the link.

Sorry for troubling you Steve.

Someshvar Vashisht

unread,
Feb 12, 2019, 10:41:29 AM2/12/19
to MIT App Inventor Forum
Hi!
It's working with the GeoJson file u sent to me.
But what is the mistake I am making in GeoJson file? I did it successfully a few months ago in one of the apps.

Regards 
Someshvar

SteveJG

unread,
Feb 12, 2019, 10:41:33 AM2/12/19
to MIT App Inventor Forum
Post your blocks and or a screen capture of your Designer screen  here in the Forum please.  Your video will not help me.

Evan Patton

unread,
Feb 12, 2019, 3:12:39 PM2/12/19
to MIT App Inventor Forum
Hi Someshvar,

The URL you provide won't work. The reason being that it contains a HTML fragment (everything after the #), which has to be evaluated by the client. The Maps component is expecting that when it retrieves content from a URL that it will be a valid GeoJSON. Accessing that URL will result in an HTML page with JavaScript that eventually results in it doing the right thing. If the site you are using can provide a permalink (a form of link where the contents will be stable) for the GeoJSON, then it should work with the maps component. Otherwise, your best bet is to download the file as a geojson file and then upload it into App Inventor.

My guess is that the internal error is due to the fact that we are expecting GeoJSON and you upload a saved copy of the HTML page, which then fails in an interesting way.

Regards,
Evan
Reply all
Reply to author
Forward
0 new messages