I have a global database of objects (points on a map) that I would like to show on a Leaflet map. Instead of loading all the database (simply too big) at once and creating the objects on a Leaflet LayerGroup, is there a more efficient way to go about querying data, perhaps as each map tile loads, or am I looking at creating a custom solution for this?
You could watch the 'moveend' event on map with map.on('moveend',loadstuff)
, make an ajax call inside loadstuff()
to grab markers inside the current map.getBounds()
, and then add/remove markers(I would assume you have some sort of global identifier for each of them) whether they are inside or outside the current view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With