calvinmetcalf / leaflet-ajax

plugin for leaflet for ajax
https://calvinmetcalf.github.io/leaflet-ajax/example/
MIT License
365 stars 189 forks source link

How not to preload #28

Open trakais opened 9 years ago

trakais commented 9 years ago

About this: "Note that data starts to download when the layer is created NOT when it’s added to the map in order to get a head start."

Is there any way not to do this? My GeoJSON is quite large. I would prefer it to be loaded only when Leaflet Control checkbox is clicked and layer is added to the map.

calvinmetcalf commented 9 years ago

So this is built around the idea that that the layer should show up when the box is checked.

What you could do is make an empty geojson layer and add a listener for it being added to the map and use that to trigger the download

On Mon, Mar 23, 2015, 3:57 PM Normunds R. notifications@github.com wrote:

About this: "Note that data starts to download when the layer is created NOT when it’s added to the map in order to get a head start."

Is there any way not to do this? My GeoJSON is quite large. I would prefer it to be loaded only when Leaflet Control checkbox is clicked and layer is added to the map.

— Reply to this email directly or view it on GitHub https://github.com/calvinmetcalf/leaflet-ajax/issues/28.