[OpenLayers-Users] Polygon Cluster

Tim Schaub tschaub at opengeo.org
Tue Oct 28 00:07:52 EDT 2008


Hey-

Jacolin Yves wrote:
> Le Monday 27 October 2008 17:28:04 Jerome Freyre, vous avez écrit :
>> Maybe If I found a solution to "uncluster" some features a zoom level, I
>> mail you ;)

It would be a pretty trivial patch to add an option to the strategy that 
would cause the "real" feature to get added to the layer instead of the 
cluster at some cluster count.  Sounds like you are talking about doing 
this with a count of 1 - but perhaps someone else would want to see real 
features with a count of 2, or 3, or whatever.

One issue with this is that a cluster feature has a different 
"interface" than an arbitrary feature.  Specifically, you can always 
find feature.attributes.count and feature.cluster on a cluster.

If you (or anyone is interested in writing patches) want this 
functionality, I would suggest adding a single property (maybe 
"threshold") to the strategy.  If this property were non-null, it would 
be a feature count at which (and below which) the pre-cluster feature(s) 
would be added to the layer instead of the cluster feature.

The threshold check would come in the cluster method of the strategy 
(before line 163 - if non-null threshold, create a new clusters array, 
loop through the existing clusters, add clusters to your new array where 
count > threshold and add real features otherwise).

If you (or anyone) creates a patch, I can help with the test writing and 
review.

Tim

> 
> Thanks !
> 
> Y.


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list