Class: QgsProcessingFeatureSourceDefinition¶
Encapsulates settings relating to a feature source input to a processing algorithm.
Enums
Methods
Loads this source definition from a QVariantMap, wrapped in a QVariant.  | 
|
Saves this source definition to a QVariantMap, wrapped in a QVariant.  | 
Attributes
If set to a value > 0, places a limit on the maximum number of features which will be read from the source.  | 
|
Optional expression filter to use for filtering features which will be read from the source.  | 
|
Flags which dictate source behavior.  | 
|
Geometry check method to apply to this source.  | 
|
  | 
|
Source definition.  | 
- class qgis.core.QgsProcessingFeatureSourceDefinition[source]¶
 Bases:
object- __init__(source: str | None = '', selectedFeaturesOnly: bool = False, featureLimit: int = -1, flags: Qgis.ProcessingFeatureSourceDefinitionFlags | Qgis.ProcessingFeatureSourceDefinitionFlag = Qgis.ProcessingFeatureSourceDefinitionFlags(), geometryCheck: Qgis.InvalidGeometryCheck = Qgis.InvalidGeometryCheck.AbortOnInvalid, filterExpression: str | None = '')
 Constructor for QgsProcessingFeatureSourceDefinition, accepting a static string
source.If
selectedFeaturesOnlyisTrue, then only selected features from the source will be used.The optional
featureLimitcan be set to a value > 0 to place a hard limit on the maximum number of features which will be read from the source.Since QGIS 3.32, the optional
filterExpressionargument can be used to specify a expression to use to filter the features read from the source.The
flagsargument can be used to specify flags which dictate the source behavior.If the
Qgis.ProcessingFeatureSourceDefinitionFlag.OverrideDefaultGeometryCheck is set inflags, then the value ofgeometryCheckwill override the default geometry check method (as dictated byQgsProcessingContext) for this source.- Parameters:
 source (Optional[str] = '')
selectedFeaturesOnly (bool = False)
featureLimit (int = -1)
flags (Union[Qgis.ProcessingFeatureSourceDefinitionFlags, Qgis.ProcessingFeatureSourceDefinitionFlag] = Qgis.ProcessingFeatureSourceDefinitionFlags())
geometryCheck (Qgis.InvalidGeometryCheck = Qgis.InvalidGeometryCheck.AbortOnInvalid)
filterExpression (Optional[str] = '')
- __init__(source: QgsProperty, selectedFeaturesOnly: bool = False, featureLimit: int = -1, flags: Qgis.ProcessingFeatureSourceDefinitionFlags | Qgis.ProcessingFeatureSourceDefinitionFlag = Qgis.ProcessingFeatureSourceDefinitionFlags(), geometryCheck: Qgis.InvalidGeometryCheck = Qgis.InvalidGeometryCheck.AbortOnInvalid, filterExpression: str | None = '')
 Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
If
selectedFeaturesOnlyisTrue, then only selected features from the source will be used.The optional
featureLimitcan be set to a value > 0 to place a hard limit on the maximum number of features which will be read from the source.Since QGIS 3.32, the optional
filterExpressionargument can be used to specify a expression to use to filter the features read from the source.The
flagsargument can be used to specify flags which dictate the source behavior.If the
Qgis.ProcessingFeatureSourceDefinitionFlag.OverrideDefaultGeometryCheck is set inflags, then the value ofgeometryCheckwill override the default geometry check method (as dictated byQgsProcessingContext) for this source.- Parameters:
 source (QgsProperty)
selectedFeaturesOnly (bool = False)
featureLimit (int = -1)
flags (Union[Qgis.ProcessingFeatureSourceDefinitionFlags, Qgis.ProcessingFeatureSourceDefinitionFlag] = Qgis.ProcessingFeatureSourceDefinitionFlags())
geometryCheck (Qgis.InvalidGeometryCheck = Qgis.InvalidGeometryCheck.AbortOnInvalid)
filterExpression (Optional[str] = '')
- __init__(a0: QgsProcessingFeatureSourceDefinition)
 - Parameters:
 
- Flag¶
 
- Flags¶
 
- featureLimit¶
 If set to a value > 0, places a limit on the maximum number of features which will be read from the source.
Added in version 3.14.
- filterExpression¶
 Optional expression filter to use for filtering features which will be read from the source.
Added in version 3.32.
- flags¶
 Flags which dictate source behavior.
Added in version 3.14.
- geometryCheck¶
 Geometry check method to apply to this source. This setting is only utilized if the
Qgis.ProcessingFeatureSourceDefinitionFlag.OverrideDefaultGeometryCheck is set in QgsProcessingFeatureSourceDefinition.flags.Added in version 3.14.
- loadVariant(self, map: Dict[str, Any]) bool[source]¶
 Loads this source definition from a QVariantMap, wrapped in a QVariant. You can use
QgsXmlUtils.readVariant to load it from an XML document.See also
Added in version 3.14.
- Parameters:
 map (Dict[str, Any])
- Return type:
 bool
- selectedFeaturesOnly¶
 Trueif only selected features in the source should be used by algorithms.
- source¶
 Source definition. Usually a static property set to a source layer’s ID or file name.
- toVariant(self) Any[source]¶
 Saves this source definition to a QVariantMap, wrapped in a QVariant. You can use
QgsXmlUtils.writeVariant to save it to an XML document.See also
Added in version 3.14.
- Return type:
 Any