Module: ol/source/Cluster

ol/source/Cluster


Classes

Cluster

Type Definitions

Options{Object}

Properties:
Name Type Argument Default Description
attributions AttributionLike <optional>

Attributions.

distance number <optional>
20

Distance in pixels within which features will be clustered together.

minDistance number <optional>
0

Minimum distance in pixels between clusters. Will be capped at the configured distance. By default no minimum distance is guaranteed. This config can be used to avoid overlapping icons. As a tradoff, the cluster feature's position will no longer be the center of all its features.

geometryFunction function <optional>

Function that takes an Feature as argument and returns an Point as cluster calculation point for the feature. When a feature should not be considered for clustering, the function should return null. The default, which works when the underlying source contains point features only, is

function(feature) {
  return feature.getGeometry();
}

See getInteriorPoint for a way to get a cluster calculation point for polygons.

createCluster function <optional>

Function that takes the cluster's center Point and an array of Feature included in this cluster. Must return a Feature that will be used to render. Default implementation is:

function(point, features) {
  return new Feature({
    geometry: point,
    features: features
  });
}
source VectorSource <optional>
null

Source.

wrapX boolean <optional>
true

Whether to wrap the world horizontally.