I use MarkerClustererPlus for clustering markers on google map (v3)

Is there a way to toggle clustering with a function. Namely I dont wont to effect markers, but only toggle visibility of cluster icons.

For showing it we have property - repaint, but I couldnt find the property to hide clusters.

有帮助吗?

解决方案

set the map-option of the markerClusterer

clustererObject.setOptions({map:null});//hides the clusterIcons
clustererObject.setOptions({map:mapObject});//restores the clusterIcons

Note: when you set the map to null all clustered markers will appear as markers, I'm not sure if this is the desired behaviour

其他提示

If you're looking to just hide all clusters, then Dr. Molle's answer works great. If you're looking to hide just a sub-group/sub-section of your maps markers, then a refresh/rebuild will be needed.

Here's an advanced example that may help others finding this page thru Google Search.

http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.1.1/examples/advanced_example.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top