CloudMade/Leaflet — Issue #420: GeoJSON - how to load from an external ressource?
Author: robertharm
Created: 2012-01-05 22:55:25+00:00
State: open

I am the developer of the Wordpress plugin "Leaflet Maps Marker" (www.mapsmarker.com) and would like to add GeoJSON support in v1.1. Unfortunately I didnt find an example how to load GeoJSON-Files from external URL.

Each map created with my plugin has a GeoJSON-URL, example: http://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-geojson.php?marker=1&callback=jsonp

As described in the tutorials here on github, I first created a new layer with:

`var geojsonLayer = new L.GeoJSON();`

then I added

` .addLayer(geojsonLayer)`

I then tried to load the GeoJSON-URL with code like this:

`var test = { 'http://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-geojson.php?marker=1&callback=jsonp' };
geojsonLayer.addGeoJSON(test);`

Unfortunately this didnt work - somehow I don´t unterstand this functions yet - can anyone please help?
Thanks!

Robert