Optionaloptions: Options<FeatureType>Cluster options.
ProtecteddisposedThe object has already been disposed.
ProtecteddistanceProtectedfeaturesProtectedgeometryCluster calculation point.
ProtectedinterpolationThis source is currently loading data. Sources that defer loading to the
map's tile queue never set this to true.
ProtectedminProtectedprojectionProtectedresolutionProtectedsourceProtectedviewProtectedviewAdd a single feature to the source. If you want to add a batch of features at once, call module:ol/source/Vector~VectorSource#addFeatures #addFeatures() instead. A feature will not be added to the source if feature with the same id is already there. The reason for this behavior is to avoid feature duplication when using bbox or tile loading strategies. Note: this also applies if an module:ol/Collection~Collection is used for features, meaning that if a feature with a duplicate id is added in the collection, it will be removed from it right away.
ProtectedaddProtectedaddProtectedapplyProtectedApply any properties from another object without triggering events.
The source object.
ProtectedclusterProtectedcreateProtectedFeatures
The searched extent for these features.
The cluster feature.
Dispatches an event and calls all listeners listening for events
of this type. The event parameter can either be a string or an
Object with a type property.
Event object.
false if anyone called preventDefault on the
event object or if any of the listeners returned false.
ProtecteddisposeIterate through all features on the source, calling the provided callback with each one. If the callback returns any "truthy" value, iteration will stop and the function will return the same value. Note: this function only iterate through the feature that have a defined geometry.
The return value from the last call to the callback.
Iterate through all features whose geometries contain the provided coordinate, calling the callback with each feature. If the callback returns a "truthy" value, iteration will stop and the function will return the same value.
For module:ol/render/Feature~RenderFeature features, the callback will be called for all features.
The return value from the last call to the callback.
Iterate through all features whose bounding box intersects the provided extent (note that the feature's geometry may not intersect the extent), calling the callback with each feature. If the callback returns a "truthy" value, iteration will stop and the function will return the same value.
If you are interested in features whose geometry intersects an extent, call the module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent() method instead.
When useSpatialIndex is set to false, this method will loop through all
features, equivalent to module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature().
The return value from the last call to the callback.
Iterate through all features whose geometry intersects the provided extent, calling the callback with each feature. If the callback returns a "truthy" value, iteration will stop and the function will return the same value.
If you only want to test for bounding box intersection, call the module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent() method instead.
The return value from the last call to the callback.
Get the closest feature to the provided coordinate.
This method is not available when the source is configured with
useSpatialIndex set to false and the features in this source are of type
module:ol/Feature~Feature.
Coordinate.
Optionalfilter: ((arg0: Feature<Geometry>) => boolean)Feature filter function. The filter function will receive one argument, the module:ol/Feature~Feature feature and it should return a boolean value. By default, no filtering is made.
Closest feature.
Get the extent of the features currently in the source.
This method is not available when the source is configured with
useSpatialIndex set to false.
Optionalextent: ExtentDestination extent. If provided, no new extent will be created. Instead, that extent's coordinates will be overwritten.
Extent.
Get a feature by its identifier (the value returned by feature.getId()). When RenderFeatures
are used, getFeatureById() can return an array of RenderFeatures. This allows for handling
of GeometryCollection geometries, where format readers create one RenderFeature per
GeometryCollection member.
Note that the index treats string and numeric identifiers as the same. So
source.getFeatureById(2) will return a feature with id '2' or 2.
Feature identifier.
The feature (or null if not found).
Get the features collection associated with this source. Will be null
unless the source was configured with useSpatialIndex set to false, or
with an module:ol/Collection~Collection as features.
The collection of features.
Get all features whose bounding box intersects the provided extent. Note that this returns an array of all features intersecting the given extent in random order (so it may include features whose geometries do not intersect the extent).
When useSpatialIndex is set to false, this method will return all
features.
Extent.
Optionalprojection: ProjectionInclude features
where extent exceeds the x-axis bounds of projection and wraps around the world.
Features.
Get a reference to the wrapped source.
Source.
ProtectedonceProtectedonProtectedremoveSets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).
Values.
Optionalsilent: booleanUpdate without triggering an event.
Replace the wrapped source.
The new source for this instance.
Protectedun
Classdesc
Layer source to cluster vector data. Works out of the box with point geometries. For other geometry types, or if not all geometries should be considered for clustering, a custom
geometryFunctioncan be defined.If the instance is disposed without also disposing the underlying source
setSource(null)has to be called to remove the listener reference from the wrapped source.Api