Reputation: 629
I want to be able to refresh all the markers every minute. This means the existing markers should be deleted parse again the data from the xml file and draw them again on the map. It apears that map.clearOverlays();
isn't working on v3 and I should interate among the markers to delete them some how.
Which is the right syntax to delete the existing markers and load new ones on a given time interval?
Upvotes: 1
Views: 4816
Reputation: 609
for (i = 0; i < markerArray.length; i++) {
markerArray[i].setMap(null);
}
That will delete every marker from the map.
Upvotes: 1
Reputation: 31920
Basically you need to use marker.setMap(null); See Google Maps API v3: How to remove all markers?
You'll want to do this in conjunction with setTimeout(), and another routine to add your markers (I assume if you've got this far you know how to add a marker already).
Upvotes: 0