This method allows to create a ClusteringTransformer
which uses different clustering parameters for different scales.
This is achieved by providing a set of scales, and for each scale a clustering transformer.
Each of the scales marks the switching point between the settings of the two clustering transformer instances
at the corresponding indices in the clustering transformer array.
// When zoomed in, avoid grouping events happening in different countries in the same clusters // and apply some custom configurations for elements classified as "Belgium" and "France". constzoomedInTransformer = create({ classifier:cityClassifier, classParameters: [{ classification:"Belgium", parameters: { noClustering:true } }, { classification:"France", parameters: { clusterSize:100, minimumPoints:4 } }] });
// When zoomed out, all the events can be clustered together. // Otherwise, we would end up with overlapping clusters as the countries become rather small constzoomedOutTransformer = create();
// Switching between the two clustering approaches should happen at a scale 1 : 25 000 000 constscaleDependentTransformer = createScaleDependent({ levelScales: [1 / 25_000_000], clusteringTransformers: [zoomedOutTransformer, zoomedInTransformer] });
Note that the scales needs to be ordered from a low value (=zoomed out scale) to a
high value (=zoomed in scale).
The clustering transformers need to use the same ordering: the transformer corresponding to the most zoomed out scale
first, and the transformer corresponding to the most zoomed in scale last.
As the scales indicate the switching point between two transformers, the number of needed transformers is equal to
the number of scales + 1.
A visual example of the relation between the scale switching points and the different transformers is given below.
The example uses 3 different switching scales, hence requires 4 transformers.
This method allows to create a ClusteringTransformer which uses different clustering parameters for different scales. This is achieved by providing a set of scales, and for each scale a clustering transformer.
Each of the scales marks the switching point between the settings of the two clustering transformer instances at the corresponding indices in the clustering transformer array.
Note that the scales needs to be ordered from a low value (=zoomed out scale) to a high value (=zoomed in scale). The clustering transformers need to use the same ordering: the transformer corresponding to the most zoomed out scale first, and the transformer corresponding to the most zoomed in scale last. As the scales indicate the switching point between two transformers, the number of needed transformers is equal to the number of scales + 1.
A visual example of the relation between the scale switching points and the different transformers is given below. The example uses 3 different switching scales, hence requires 4 transformers.