Class: QgsFeatureSink¶
An interface for objects which accept features via addFeature(s) methods.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: addFeatures()
List of all members, including inherited members
Class Hierarchy¶
Subclasses¶
Represents a vector layer which manages a vector based dataset. |
|
A container for features with the same fields and crs. |
|
A simple feature sink which proxies feature addition onto another feature sink. |
|
A |
|
A spatial index for |
|
Base class for vector data providers. |
|
A convenience class for writing vector layers to disk based formats (e.g. Shapefiles, GeoPackage). |
|
A convenience class for exporting vector layers to a destination data provider. |
|
Manages joined fields for a vector layer. |
|
A feature pool is based on a vector layer and caches features. |
Enums
Abstract Methods
Adds a list of features to the sink. |
Methods
Virtual Methods
In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsFeatureSink. See the FAQ for more details.
Adds a single feature to the sink. |
|
Finalizes the sink, flushing any buffered features to the destination. |
|
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. |
|
Returns the most recent error encountered by the sink, e.g. when a call to |
- class qgis.core.QgsFeatureSink[source]¶
Bases:
object- FastInsert = 2¶
- Flags()¶
- RegeneratePrimaryKey = 2¶
- RollBackOnErrors = 4¶
- SinkFlags()¶
- virtual addFeature(self, feature: QgsFeature, flags: QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool[source]¶
Adds a single
featureto the sink. Feature addition behavior is controlled by the specifiedflags.See also
- Return type:
bool
- Returns:
Truein case of success andFalsein case of failure- Parameters:
feature (QgsFeature)
flags (QgsFeatureSink.Flag = QgsFeatureSink.Flags())
- abstract addFeatures(self, features: Iterable[QgsFeature], flags: QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool[source]¶
Adds a list of
featuresto the sink. Feature addition behavior is controlled by the specifiedflags.See also
- Returns:
Truein case of success andFalsein case of failure
addFeatures(self, iterator:
QgsFeatureIterator, flags: QgsFeatureSink.Flag = QgsFeatureSink.Flags()) -> bool Adds all features from the specifiediteratorto the sink. Feature addition behavior is controlled by the specifiedflags.- Return type:
bool
- Returns:
Trueif all features were added successfully, orFalseif any feature could not be added- Parameters:
features (Iterable[QgsFeature])
flags (QgsFeatureSink.Flag = QgsFeatureSink.Flags())
- virtual finalize(self)[source]¶
Finalizes the sink, flushing any buffered features to the destination.
Added in version 3.42.
- virtual flushBuffer(self) bool[source]¶
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink’s destination.
- Return type:
bool
- Returns:
Falseif any buffered features could not be added to the sink.
- virtual lastError(self) str[source]¶
Returns the most recent error encountered by the sink, e.g. when a call to
addFeatures()returnsFalse.Added in version 3.16.
- Return type:
str