Let me walk you through my Google Maps setup process:
- To start, I retrieve the locations of all markers (usually under 300) from a database and send them to JavaScript in JSON format.
- Within JavaScript, I parse the JSON data, iterate through the marker array, and create new google.maps.Markers. Each marker is equipped with an event listener that triggers an infobox (utilizing infoBox.js) containing a main picture and additional details. To manage the markers effectively, I utilize clustering via MarkerClusterer which has proven successful for hundreds of markers.
Now, my goal is to scale up and display around 10,000 markers using MarkerClusterer. What would be the most efficient approach to achieve this?
I was contemplating storing all marker data in a file, such as a JavaScript array or XML, and having JavaScript read from there instead of directly querying the database for 10,000 locations. However, I am open to other suggestions if you have any.
Should I continue looping through the array and placing one marker at a time? I briefly explored KML layers but realized they may not offer the functionality I need, especially regarding navigation between markers with features like prev/next location and potentially compatibility issues with infobox.js.
If you have any advice or recommendations on how to efficiently handle a large number of markers on Google Maps, please share!