Extended clustering example

# Extended clustering

cluster, advanced

Shows the usage of custom classes for a fine grained control about the clustering behaviour.

Select the desired clustering strategy:

No strategy
Simple cluster-strategy
Attributive cluster-strategy
Rulebased cluster-strategy

The vectorlayer in this example contains random data with an attribute "clazz" that can take the values 1, 2, 3 and 4. The features with clazz = 4 are considered more important than the others.

The radiobuttons on the right of the map control the cluster strategy to be applied to the features.

- No strategy means that all features are rendered, no clustering shall be applied
- Simple cluster-strategy applies the cluster strategy with default options to the layer. You should notice that many of the important features with clazz = 4 are getting lost, since clustering happens regardless of feature attributes
- Attributive cluster-strategy uses a customized cluster strategy. This strategy is configured to cluster features of the same clazz only. You should be able to see all red points (clazz = 4) even though the data is clustered. A cluster now contains only features of the same clazz.
- Rulebased cluster-strategy uses another customized cluster strategy. This strategy is configured to cluster features that follow a certain rule only. In this case only features with a clazz different from 4 are considered as candidates for clustering. That means that usually you have fewer clusters on the map, yet all with clazz = 4 are easily distinguishable

Hover over the features to get a short infomation about the feature or cluster of features.

View the strategy-cluster-extended.js source to see how this is done.