upload and add layer "on the fly" from geojson feature, from json external file

365 views
Skip to first unread message

Kolam Training Center Admin

unread,
Dec 17, 2012, 5:31:44 AM12/17/12
to leafl...@googlegroups.com
Hi,
i would like to add a simple control to upload a new local geojson file, add a new layer for it and display its content on the map.
I saw how to parse json content, i know how to add layer, how to automaticly load a geojson file and show it, BUT

i don't know how to let the user doing this by his own !
i mean:

  1. selecting a new json file on his computer and give a name for the new layer
  2. creating a temporary layer to include the geojson feature (from the file)
  3. showing the content of this file on the leaflet map

i assume that after reloading the page, the layer is not there anymore (it's ok for me!)
I wouldn't like to use jquery for that, a simple ajax call must be nough ?..please :)

thanks for your answer,bye

Bryan McBride

unread,
Dec 17, 2012, 11:13:27 PM12/17/12
to leafl...@googlegroups.com
You might want to take a look at Jason Sanford's GeoJSONLint project, as this is very similar: http://geojsonlint.com/. The source is up on github at https://github.com/JasonSanford/geojsonlint.com.

BRYAN
Reply all
Reply to author
Forward
0 new messages