show/hide markerCluster Icon

1,318 views
Skip to first unread message

Rainer Pansen

unread,
Nov 9, 2010, 5:49:11 AM11/9/10
to Google Maps JavaScript API v3
Dear all,
I use MarkerClusterer on my map, and i`ve built some checkboxes , so
the user can control the visibility of the markers.
This works pretty fine with the regular markers. Is there any
possibilty to control the visibility of the Clustermarkers themselves?

Thank you very much for your help!
Regards
peter


Rossko

unread,
Nov 9, 2010, 7:10:36 AM11/9/10
to Google Maps JavaScript API v3
> This works pretty fine with the regular markers. Is there any
> possibilty to control the visibility of the Clustermarkers themselves?

I'm not sure what that means. Do you want the clusterer to
recalculate its clusters after a change in visibility of markers?
Something like this
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/83f28a21e7fe8578/27370bfa62992f18

Rainer Pansen

unread,
Nov 9, 2010, 9:30:09 AM11/9/10
to Google Maps JavaScript API v3
thanks for the answer,
the clusterer shouldn't recalculate the clusters.

i've got two categories of markers. blue and green.
i've got one clusterer for the blue and one for the green, and with
click on a checkbox i can show/hide the all of the blue or all of the
green markers (depending on the checkbox).
This works for the "single markers". When a couple of markers are
clustered to one big marker i also want the "clustermarker" to be
hidden/shown with a click on the checkbox.
That doesn't work until now.
i hope that was understandable
thanks
peter

Rossko

unread,
Nov 9, 2010, 10:43:20 AM11/9/10
to Google Maps JavaScript API v3
> i've got two categories of markers. blue and green.
> i've got one clusterer for the blue and one for the green, and with
> click on a checkbox i can show/hide the  all of the blue or all of the
> green markers (depending on the checkbox).

Then as part of the code that shows/hides all the blue markers you'd
want to show/hide the blue clusterer, by getting it to work a new
array of markers (which could be empty)

Rainer Pansen

unread,
Nov 9, 2010, 11:06:25 AM11/9/10
to Google Maps JavaScript API v3
sorry i dont exactly understand what you mean, could you specify it?
thanks

Rossko

unread,
Nov 9, 2010, 3:06:08 PM11/9/10
to Google Maps JavaScript API v3
Here's the docs for clusterer
http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/docs/reference.html
Notice the clearMarkers() method
When you hide blue markers, clear the blue clusterer.
When you show blue markers, add the markers to the blue clusterer.
Reply all
Reply to author
Forward
0 new messages