[OpenLayers-Users] detecting zoom changes not center changes

Craig Stanton c.stanton at niwa.co.nz
Mon May 11 00:31:54 EDT 2009


Hi All,
    I've got a few thousand features drawn on a map using the Clustering strategy. When the map is dragged around I'd like to keep the features on the map until the drag is over and then fetch new data using the new BBOX. But if the map is zoomed in a lot, the clustering strategy is incredibly slow, so I want to remove all features from the map before the re-clustering happens. Right now I can set up events for movestart, moveend and zoomend. "Movestart" is called at the right time, i.e. before the map has been zoomed and the clustering happens on the full data, but I can't determine if the map has been zoomed or dragged. The getZoom() function returns the same value as it had before the movestarted. I guess what I need falls into three 
 
i) An event called zoomstart, that is only fired when the zoom value is changed
ii) a function called getSoonToBeZoomLevel() which gets the value that the map is being zoomed to
iii) A way to stop the clustering from recalculating when the map is zoomed in, and to only occur when I tell it to.
 
 
Surely someone solved this sort of thing before. How did you do it?
 
Cheers,
    Craig

NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090511/65cad121/attachment.html


More information about the Users mailing list