I've came across a similar problem on my own. To display infoWindows for each unit on the map, I got some trouble if that features was clustered, so I zoomed in to that feature. If those features are very close, they could still be clustered. So I wanted to disable the clustering from a certain zoomlevel.
I allready had some trouble disabling the clustering, so I've came up with this:
If you set the threshold of the clustering strategy to the total features + 1 there is no clustering.
If you have such a toggle function, you can register it to the zoomend event.
I've used this allready in a toggle function. I only added some ugly if statements to check who's calling the toggle function. The register function calls the listener with an object.
So after creating the layer and strategy:
myMap.map.events.register("zoomend", "zoom", toggleCluster);
(I've no idea what the second parameter does....)
The myMap object holds the map
the myUnit object holds a reference to the layer and also the toggle function.
toggleCluster: function(status) {
if (myUnit.layer.strategies[0].features != null){
var max = myUnit.layer.strategies[0].features.length;
} else {
// no features, don't care
return;
}
if (status && status.type == "zoomend") {
if (myMap.map.zoom > myUnit.zoomThreshold-1 ) {
console.log("cluster off");
myUnit.layer.strategies[0].threshold = max + 1;
} else {
console.log("cluster on");
myUnit.layer.strategies[0].threshold = myUnit.clusterThreshold;
}
} else {
if (myUnit.layer.strategies[0].threshold == myUnit.clusterThreshold) {
myUnit.layer.strategies[0].threshold = max + 1;
} else {
myUnit.layer.strategies[0].threshold = myUnit.clusterThreshold;
}
}
myUnit.layer.removeFeatures(tbUnit.layer.features);
myUnit.layer.redraw();
},