In OpenLayers, I have a cluster strategy to limit how many features/points the user sees on the map. When the user is fully zoomed in however, I want to turn off the clustering strategy so that all features are shown. To do this I am catching the zoom event like this:
map.events.register("zoomend", this, function (e) {
if (map.getZoom() === this.mapMaxZoom) {
// Don't cluster at this level. No matter what.
this.vector.strategies[0].threshold = 1000;
console.log("setting the clustering strategy to 1000");
}
});
This kinda works, but I don't see the new clustering applied - I have to zoom back out again to see the clustering change to a threshold of 1000 (and thus show all features). I need some way to force openlayers to refresh. I've tried calling map.redraw() but that doesn't help. Any ideas?
vectorlayer.refresh({force:true});
Try this.