I\'ve looked at the docs and can\'t figure it out. I\'m sure I\'m missing something stupid. No errors, but no clustering.
I tried to take the simple example from he
You aren't adding an array of google.maps.Marker objects to the MarkerClusterer.
add a global array to store the google.maps.Markers in:
var gmarkers=[];
add the markers created by addMarker to that array:
function addMarker(feature) {
var marker = new google.maps.Marker({
position: feature.position,
icon: icons[feature.type].icon,
shadow: {
url: icons[feature.type].shadow,
anchor: new google.maps.Point(21, 32)
},
animation: google.maps.Animation.DROP,
map: map
});
gmarkers.push(marker);
google.maps.event.addListener(marker, "click", function () {
infowindow.setContent(feature.data);
infowindow.open(map,marker);
map.setZoom(3);
map.setCenter(marker.getPosition());
});
}
add that array of google.maps.Markers to the MarkerClusterer (rather than the "features" array of objects).
var mc = new MarkerClusterer(map, gmarkers, mcOptions);
working example