zonelsk
zonelsk

Reputation: 245

Marker Clusterer Plus remove cluster on click

i'm using this tool

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/

for clustering markers that are in the exact spot or very close (gridSize: 5)

What I want to do is to remove a cluster (not all, just one) on click and spiderfy markers with

https://github.com/jawj/OverlappingMarkerSpiderfier

Can this be done?

In reference of Marker clusterer I didn't find any function/method that removes a particular cluster.

Thx in advance.

Upvotes: 0

Views: 1689

Answers (1)

Felipe Pereira
Felipe Pereira

Reputation: 12300

I would use my own version of MarkerClustererPlus with a small modification:

//@150 of MarkerClustererPlus: modify to send cClusterIcon.div_ on the click event
google.maps.event.trigger(mc, "click", cClusterIcon.cluster_, cClusterIcon.div_);

And in your code use it like this:

google.maps.event.addListener(markerCluster, 'click', function (cluster, clusterIcon) {
    clusterIcon.remove();
    //Do the other stuff with the markers ...
    var markers = cluster.getMarkers();
});

Upvotes: 1

Related Questions