I don't know your code but I would assume that you are looking for something 
like this:

var map = new OpenLayers.Map('mapDiv', mapOptions);
var clusterStrategy = new OpenLayers.Strategy.Cluster(clusterOptions); 
var layerOptions = {
  strategies: [clusterStrategy]
};
var vectorLayers = new OpenLayers.Layer.Vector('features', layerOptions);

// cluster threshold
var clusterMaxZoom = 10;

map.events.register('move', null, function() {  // #2, #3 respond to map extent 
change
  // disable cluster when zoom greater than threshold
  if (map.getZoom() > clusterMaxZoom) {  // #2.1 how to read current zoom
    clusterStrategy.deactivate();  // #2.2 how to disable cluster strategy
  } else {
    clusterStrategy.activate();
  }

  // filter features based on bounding box
  var extent = map.getExtent();  // #3.1

  // reload features here, it depends on how you read your features in now

});

If you are not using a Protocol like WFS () with your layer then the BBOX 
strategy will have no effect and you will have to manually reload features 
using whatever mechanism you are using now.

Cheers

Paul

On 2011-02-16, at 7:58 AM, Mihai Visan wrote:

> Thanks Paul,
> 
> I already read the documentation and all tutorial and user discusions I could 
> found.
> 
> But I'm a week at javascript, so I could use some examples or tutorials  I 
> could transform
> 
> -----Original Message----- From: Paul Spencer
> Sent: Wednesday, February 16, 2011 2:43 PM
> To: Mihai Visan
> Subject: Re: [OpenLayers-Users] cluster strategy
> 
> Mihai, all of your questions have answers in the documentation ...
> 
> On 2011-02-16, at 7:29 AM, Mihai Visan wrote:
> 
>> 2. disable cluster strategy at certain zoom level.
>>    Problems:     2.1. I don’t know how to read current zoom
> 
> http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.getZoom
> 
>>                        2.2. I don’t know to disable cluster strategy
> 
> http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Strategy/Cluster-js.html#OpenLayers.Strategy.Cluster.deactivate
> 
>> 
>> 3. use (BBOX strategy and) ajax to disable features outside visible bounds
>>    Problems:    3.1. I don’t know how to read visible bounds
> 
> http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.getExtent
> 
>>                       3.2. I don’t know  how to integrate ajax with (BBOX 
>> and) mouse drag or zoom in/out
> 
> http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.EVENT_TYPES
> 
> Cheers
> 
> Paul 

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to