Class: QgsFeaturePool¶
- class qgis.analysis.QgsFeaturePool¶
Bases:
QgsFeatureSink
A feature pool is based on a vector layer and caches features.
Note
This class is a technology preview and unstable API.
New in version 3.4.
QgsFeaturePool(layer:
QgsVectorLayer
) Creates a new feature pool forlayer
.Methods
The coordinate reference system of this layer.
Removes a feature from this pool.
The geometry type of this layer.
Retrieves the feature with the specified
id
intofeature
.Gets a pointer to the underlying layer.
The layer id of the layer.
Returns the name of the layer.
Updates a feature in this pool.
- crs(self) QgsCoordinateReferenceSystem ¶
The coordinate reference system of this layer.
- Return type
- deleteFeature(self, fid: int)¶
Removes a feature from this pool. Implementations will remove the feature from the layer or from the data provider.
- Parameters
fid (int) –
- geometryType(self) QgsWkbTypes.GeometryType ¶
The geometry type of this layer.
- Return type
- getFeature(self, id: int, feature: QgsFeature) bool ¶
Retrieves the feature with the specified
id
intofeature
. It will be retrieved from the cache or from the underlying feature source if unavailable. If the feature is neither available from the cache nor from the source it will returnFalse
.- Parameters
id (int) –
feature (QgsFeature) –
- Return type
bool
- layer(self) QgsVectorLayer ¶
Gets a pointer to the underlying layer. May return a
``None``
if the layer has been deleted. This must only be called from the main thread.- Return type
- layerId(self) str ¶
The layer id of the layer.
- Return type
str
- layerName(self) str ¶
Returns the name of the layer.
Should be preferred over
layer()
.name() because it can directly be run on the background thread.- Return type
str
- updateFeature(self, feature: QgsFeature)¶
Updates a feature in this pool. Implementations will update the feature on the layer or on the data provider.
- Parameters
feature (QgsFeature) –