Optional
options: Options<FeatureType>Vector source options.
Protected
disposedThe object has already been disposed.
This source is currently loading data. Sources that defer loading to the
map's tile queue never set this to true
.
Protected
projectionProtected
viewProtected
viewAdd 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.
Feature to add.
Protected
addProtected
Add a feature without firing a change
event.
Feature.
Add a batch of features to the source.
Features to add.
Protected
addProtected
Add features without firing a change
event.
Features.
Protected
applyProtected
Apply any properties from another object without triggering events.
The source object.
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.
Protected
disposeIterate 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.
Called with each feature on the source. Return a truthy value to stop iteration.
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.
Coordinate.
Called with each feature whose goemetry contains the provided coordinate.
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().
Extent.
Called with each feature whose bounding box intersects the provided extent.
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.
Extent.
Called with each feature whose geometry intersects the provided extent.
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.
Optional
filter: ((arg0: FeatureType) => 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
.
Optional
extent: 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 RenderFeature
s
are used, getFeatureById()
can return an array of RenderFeature
s. 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 a feature by its internal unique identifier (using getUid
).
Feature identifier.
The feature (or null
if not found).
Get a snapshot of the features currently on the source in random order. The returned array is a copy, the features are references to the features in the source.
Features.
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.
Optional
projection: ProjectionInclude features
where extent
exceeds the x-axis bounds of projection
and wraps around the world.
Features.
Get the format associated with this source.
The feature format.
Returns true if the feature is contained within the source.
Feature.
Has feature.
Protected
onceProtected
onRemove a single feature from the source. If you want to batch remove features, use the module:ol/source/Vector~VectorSource#removeFeatures #removeFeatures() method instead.
Feature to remove.
Protected
removeProtected
Remove feature without firing a change
event.
Feature.
The removed feature (or undefined if the feature was not found).
Batch remove features from the source. If you want to remove all features at once, use the module:ol/source/Vector~VectorSource#clear #clear() method instead.
Features to remove.
Set the new loader of the source. The next render cycle will use the new loader.
The loader to set.
Sets 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.
Optional
silent: booleanUpdate without triggering an event.
Protected
un
Classdesc
Provides a source of features for vector layers. Vector features provided by this source are suitable for editing. See module:ol/source/VectorTile~VectorTile for vector data that is optimized for rendering.
Fires
VectorSourceEvent
Api