Search code examples
javascriptgoogle-maps-api-3markerclusterer

How to keep just one specific marker from a markercluster?


I have a markercluster.

I have a listener for every marker in it.

When I click on it, I go into its listener routine.

Now how do I keep this marker and remove all others from the cluster?

I did this but it somehow doesnt work

temp.push(this);
markerCluster_new.addMarkers(temp);
markerCluster_old.clearMarkers();

Solution

    • Remove all the markers
    • Reinsert the one you want to keep