Class: QgsProcessingFeatureSource

QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingFeatureSource

Base classes

QgsFeatureSource

An interface for objects which provide features via a getFeatures method.

Enums

Flag

alias of ProcessingFeatureSourceFlag

Abstract Methods

getFeatures

Returns an iterator for the features in the source, respecting the supplied feature flags.

Methods

createExpressionContextScope

Returns an expression context scope suitable for this source.

invalidGeometryCheck

Returns the geometry check method for the source.

setInvalidGeometryCheck

Overrides the default geometry check method for the source.

class qgis.core.QgsProcessingFeatureSource[source]

Bases: QgsFeatureSource

__init__(originalSource: QgsFeatureSource | None, context: QgsProcessingContext, ownsOriginalSource: bool = False, featureLimit: int = -1, filterExpression: str | None = '')

Constructor for QgsProcessingFeatureSource, accepting an original feature source originalSource and processing context. Ownership of originalSource is dictated by ownsOriginalSource. If ownsOriginalSource is False, ownership is not transferred, and callers must ensure that originalSource exists for the lifetime of this object. If ownsOriginalSource is True, then this object will take ownership of originalSource.

If featureLimit is set to a value > 0, then a limit is placed on the maximum number of features which will be read from the source.

Since QGIS 3.32, the optional filterExpression can be used to specify an expression based filter for the source.

Parameters:
__init__(a0: QgsProcessingFeatureSource)
Parameters:

a0 (QgsProcessingFeatureSource)

Flag

alias of ProcessingFeatureSourceFlag

Flags

alias of ProcessingFeatureSourceFlags

createExpressionContextScope(self) QgsExpressionContextScope | None[source]

Returns an expression context scope suitable for this source.

Return type:

Optional[QgsExpressionContextScope]

abstract getFeatures(self, request: QgsFeatureRequest, flags: Qgis.ProcessingFeatureSourceFlags | Qgis.ProcessingFeatureSourceFlag) QgsFeatureIterator[source]

Returns an iterator for the features in the source, respecting the supplied feature flags. An optional request can be used to optimise the returned iterator, eg by restricting the returned attributes or geometry.

Parameters:
Return type:

QgsFeatureIterator

abstract getFeatures(self, request: QgsFeatureRequest = QgsFeatureRequest()) QgsFeatureIterator[source]
Parameters:

request (QgsFeatureRequest = QgsFeatureRequest())

Return type:

QgsFeatureIterator

invalidGeometryCheck(self) Qgis.InvalidGeometryCheck[source]

Returns the geometry check method for the source.

Added in version 3.36.

Return type:

Qgis.InvalidGeometryCheck

setInvalidGeometryCheck(self, method: Qgis.InvalidGeometryCheck)[source]

Overrides the default geometry check method for the source.

Added in version 3.14.

Parameters:

method (Qgis.InvalidGeometryCheck)