how can i remove all cluster icons (cluster markers) from map? tryed with advices like:
Google Maps API v3: How to remove all markers?
… but it did not worked.
can you help me how to achieve that?
thank you in advance!
UPDATE (2010-11-23)
markers are stored in array with
var markersClust = Array();
… and are added with (combination with php):
markersClust.push(marker_<?php echo $team["Team"]["id"]; ?>);
var markerClusterer = new MarkerClusterer(MyMap.map, markersClust, clusterOptions);
and it works fine.
but, i can not remove them from a map, and it drives me…
tryed to remove markers (and i did) with
for ( var i=0; i < markersClust.length; i++) {
markersClust[i].setMap(null);
}
markersClust = [];
but cluster icons are stil on the map.
also i tryed things like:
markerClusterer.clearMarkers();
and like
MyMap.preventDefault();
MyMap.stopPropagation();
MyMap.clearMarkers();
but, again, icons of the clusters are still there, on a map.
what else do i have to do to remove those cluster icons from my map? please help…
Iterate over each marker and set that marker’s map to null. That will remove the marker from the map.