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/VectorVectorSource#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/CollectionCollection 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.
Protected
addProtected
addProtected
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.
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.
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
.
Coordinate.
Optional
filter: ((arg0) => 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()).
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.
Optional
projection: ProjectionInclude features
where extent
exceeds the x-axis bounds of projection
and wraps around the world.
Features.
Protected
onProtected
onceProtected
removeSets 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