Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get all markers on google-maps-v3

Is there a way to get all the markers on Google Maps?

like image 829
zjm1126 Avatar asked Apr 05 '10 07:04

zjm1126


People also ask

What is the maximum number of markers on Google Maps?

WP Google Maps supports a theoretically unlimited number of markers, the only practical limitations are your servers resources and the performance of your target audiences devices. The plugin will easily handle 3,200 locations.


2 Answers

If you mean "how can I get a reference to all markers on a given map" - then I think the answer is "Sorry, you have to do it yourself". I don't think there is any handy "maps.getMarkers()" type function: you have to keep your own references as the points are created:

var allMarkers = [];
....
// Create some markers
for(var i = 0; i < 10; i++) {
    var marker = new google.maps.Marker({...});
    allMarkers.push(marker);
}
...

Then you can loop over the allMarkers array to and do whatever you need to do.

like image 179
Mr Speaker Avatar answered Oct 10 '22 15:10

Mr Speaker


The one way found is to use the geoXML3 library which is suitable for usage along with KML processor Version 3 of the Google Maps JavaScript API.

like image 26
Igor Avatar answered Oct 10 '22 14:10

Igor