Loading markers on Google maps dynamically on a move / drag / pan map

I need to display a set of markers on a google map. In addition, I need to show additional markers loaded dynamically when the user clicks on the map.

The number of markers can be in thousands, of which 30-50 should be displayed initially. Other markers should only be loaded and displayed when the user clicks on the area containing the markers. I was thinking about using token managers, but I'm not sure that tokens can be loaded dynamically into the token manager. I want something more than this card. Notice how images load when panning a map and collecting garbage when you bounce.

Clustering tokens is not important, but can be enjoyable.

+5
source share
1 answer

I do this with clustering in a data set of several thousand markers. Here's how I do it: when the "moveend" event occurs, I get the borders of the map and send an ajax request to the server. I get tokens from your database that are within the boundaries and send them to the client. If you have questions about a specific part of the process, just let me know.

Also, with Marker Manager, I believe that you can add tokens dynamically.

+2
source

All Articles