Skip to content Skip to sidebar Skip to footer

'invalid Geojson Object.' Using Leaflet And Leaflet-ajax

I'm using leaflet to build a map of France, with the regions highlighted, and on-click zoom. I used this tutorial first: http://leafletjs.com/examples/choropleth.html First, I've

Solution 1:

Your call to onEachFeature has to be in your AJAX call

var BordeauxLayer = new L.GeoJSON.AJAX("src/js/DI_Bordeaux.geojson", {onEachFeature: onEachFeature}).addTo(map);

You also have to get rid of

L.geoJson(BordeauxLayer,{onEachFeature: onEachFeature}).addTo(map);

Post a Comment for "'invalid Geojson Object.' Using Leaflet And Leaflet-ajax"