Class: QgsProcessingFeatureSource¶
- class qgis.core.QgsProcessingFeatureSource¶
Bases:
QgsFeatureSource
QgsFeatureSource
subclass which proxies methods to an underlyingQgsFeatureSource
, modifying results according to the settings in aQgsProcessingContext
.QgsProcessingFeatureSource(originalSource:
QgsFeatureSource
, context:QgsProcessingContext
, ownsOriginalSource: bool = False, featureLimit: int = -1, filterExpression: str = ‘’) Constructor forQgsProcessingFeatureSource
, accepting an original feature sourceoriginalSource
and processingcontext
. Ownership oforiginalSource
is dictated byownsOriginalSource
. IfownsOriginalSource
isFalse
, ownership is not transferred, and callers must ensure thatoriginalSource
exists for the lifetime of this object. IfownsOriginalSource
isTrue
, then this object will take ownership oforiginalSource
.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.QgsProcessingFeatureSource(
QgsProcessingFeatureSource
)Enums
alias of
ProcessingFeatureSourceFlag
Methods
- rtype:
object
Returns an expression context scope suitable for this source.
- rtype:
int
- rtype:
QgsFields
Returns an iterator for the features in the source, respecting the supplied feature
flags
.- rtype:
Qgis.FeatureAvailability
- rtype:
Qgis.SpatialIndexPresence
Returns the geometry check method for the source.
- param fieldIndex:
- param fieldIndex:
Overrides the default geometry check method for the source.
- rtype:
QgsCoordinateReferenceSystem
- rtype:
QgsRectangle
- rtype:
str
- param fieldIndex:
- rtype:
Qgis.WkbType
- Flag¶
alias of
ProcessingFeatureSourceFlag
- Flags¶
alias of
ProcessingFeatureSourceFlags
- allFeatureIds(self) object ¶
- Return type:
object
- createExpressionContextScope(self) QgsExpressionContextScope ¶
Returns an expression context scope suitable for this source.
- Return type:
- featureCount(self) int ¶
- Return type:
int
- getFeatures(self, request: QgsFeatureRequest, flags: Qgis.ProcessingFeatureSourceFlags | Qgis.ProcessingFeatureSourceFlag) QgsFeatureIterator ¶
Returns an iterator for the features in the source, respecting the supplied feature
flags
. An optionalrequest
can be used to optimise the returned iterator, eg by restricting the returned attributes or geometry.getFeatures(self, request:
QgsFeatureRequest
= QgsFeatureRequest()) -> QgsFeatureIterator- Parameters:
request (QgsFeatureRequest) –
flags (Union[Qgis.ProcessingFeatureSourceFlags) –
- Return type:
- hasFeatures(self) Qgis.FeatureAvailability ¶
- Return type:
- hasSpatialIndex(self) Qgis.SpatialIndexPresence ¶
- Return type:
- invalidGeometryCheck(self) Qgis.InvalidGeometryCheck ¶
Returns the geometry check method for the source.
See also
New in version 3.36.
- Return type:
- maximumValue(self, fieldIndex: int) Any ¶
- Parameters:
fieldIndex (int) –
- Return type:
Any
- minimumValue(self, fieldIndex: int) Any ¶
- Parameters:
fieldIndex (int) –
- Return type:
Any
- setInvalidGeometryCheck(self, method: Qgis.InvalidGeometryCheck)¶
Overrides the default geometry check method for the source.
See also
New in version 3.14.
- Parameters:
method (Qgis.InvalidGeometryCheck) –
- sourceCrs(self) QgsCoordinateReferenceSystem ¶
- Return type:
- sourceExtent(self) QgsRectangle ¶
- Return type:
- sourceName(self) str ¶
- Return type:
str
- uniqueValues(self, fieldIndex: int, limit: int = -1) Set[Any] ¶
- Parameters:
fieldIndex (int) –
limit (int = -1) –
- Return type:
Set[Any]
- wkbType(self) Qgis.WkbType ¶
- Return type: