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()
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. |
Abstract Methods
Adds a list of features to the sink. |
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 |
Attributes
- class qgis.core.QgsFeatureSink[source]¶
Bases:
object
- FastInsert = 2¶
- class Flag¶
Bases:
int
- class Flags¶
- class Flags(f: QgsFeatureSink.Flags | QgsFeatureSink.Flag)
- class Flags(a0: QgsFeatureSink.Flags)
Bases:
object
- RegeneratePrimaryKey = 2¶
- RollBackOnErrors = 4¶
- class SinkFlag¶
Bases:
int
- class SinkFlags¶
- class SinkFlags(f: QgsFeatureSink.SinkFlags | QgsFeatureSink.SinkFlag)
- class SinkFlags(a0: QgsFeatureSink.SinkFlags)
Bases:
object
- virtual addFeature(self, feature: QgsFeature, flags: QgsFeatureSink.Flags | QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool [source]¶
Adds a single
feature
to the sink. Feature addition behavior is controlled by the specifiedflags
.See also
- Return type:
bool
- Returns:
True
in case of success andFalse
in case of failure- Parameters:
feature (QgsFeature)
flags (Union[QgsFeatureSink.Flags, QgsFeatureSink.Flag] = QgsFeatureSink.Flags())
- abstract addFeatures(self, features: Iterable[QgsFeature], flags: QgsFeatureSink.Flags | QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool [source]¶
Adds a list of
features
to the sink. Feature addition behavior is controlled by the specifiedflags
.See also
- Return type:
bool
- Returns:
True
in case of success andFalse
in case of failure- Parameters:
features (Iterable[QgsFeature])
flags (Union[QgsFeatureSink.Flags, QgsFeatureSink.Flag] = QgsFeatureSink.Flags())
- abstract addFeatures(self, iterator: QgsFeatureIterator, flags: QgsFeatureSink.Flags | QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool [source]
Adds all features from the specified
iterator
to the sink. Feature addition behavior is controlled by the specifiedflags
.- Return type:
bool
- Returns:
True
if all features were added successfully, orFalse
if any feature could not be added- Parameters:
iterator (
QgsFeatureIterator
)flags (Union[QgsFeatureSink.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:
False
if 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