Optional
opt_options: olx.source.VectorOptionsVector source options.
Provides a source of features for vector layers. Vector features provided by this source are suitable for editing. See ol.source.VectorTile for vector data that is optimized for rendering.
ol.source.VectorEvent
stable
Add a single feature to the source. If you want to add a batch of features at once, call source.addFeatures() instead.
stable
Iterate 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.
Called with each feature on the source. Return a truthy value to stop iteration.
Optional
opt_this: TThe object to use as this
in the callback.
The return value from the last call to the callback.
stable
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 * source.forEachFeatureIntersectingExtent() method instead.
When useSpatialIndex
is set to false, this method will loop through all
features, equivalent to ol.source.Vector#forEachFeature.
Extent.
Called with each feature whose bounding box intersects the provided extent.
Optional
opt_this: TThe object to use as this
in the callback.
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 * source.forEachFeatureInExtent() method instead.
Extent.
Called with each feature whose geometry intersects the provided extent.
Optional
opt_this: TThe object to use as this
in the callback.
The return value from the last call to the callback.
Get the attributions of the source.
Attributions.
stable
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
opt_filter: ((feature) => boolean)Feature filter function. The filter function will receive one argument, the feature and it should return a boolean value. By default, no filtering is made.
Closest feature.
stable
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).
stable
Get all features whose geometry intersects the provided coordinate.
Coordinate.
Features.
stable
Get the features collection associated with this source. Will be null
unless the source was configured with useSpatialIndex
set to false
, or
with an ol.Collection as features
.
The collection of features.
Get all features in the provided extent. Note that this returns all features whose bounding boxes intersect the given extent (so it may include features whose geometries do not intersect the extent).
This method is not available when the source is configured with
useSpatialIndex
set to false
.
Extent.
Features.
Get the logo of the source.
Logo.
stable
Get the projection of the source.
Projection.
Get the state of the source, see ol.source.State for possible states.
State.
Get the url associated with this source.
The url.
Listen for a certain type of event.
The event type or array of event types.
The listener function.
Optional
opt_this: ObjectThe object to use as this
in listener
.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
stable
Listen once for a certain type of event.
The event type or array of event types.
The listener function.
Optional
opt_this: ObjectThe object to use as this
in listener
.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
stable
Remove a single feature from the source. If you want to remove all features at once, use the source.clear() method instead.
stable
Set the attributions of the source.
Attributions.
Can be passed as string
, Array<string>
, {@link ol.Attribution}
,
Array<{@link ol.Attribution}>
or undefined
.
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
opt_silent: booleanUpdate without triggering an event.
stable
Removes an event listener using the key returned by on()
or once()
.
Note that using the ol.Observable.unByKey static function is to
be preferred.
stable
Static
unGenerated using TypeDoc
Classdesc
Provides a source of features for vector layers. Vector features provided by this source are suitable for editing. See ol.source.VectorTile for vector data that is optimized for rendering.
Fires
ol.source.VectorEvent
Param: opt_options
Vector source options.
Api
stable