Class: QgsProcessingParameters¶
A collection of utilities for working with parameters when running a processing algorithm.
Parameters are stored in a QVariantMap and referenced by a unique string
key. The QVariants in parameters are not usually accessed directly, and
instead the high level API provided through
QgsProcessingParameters
parameterAsString()
,
parameterAsDouble()
are used instead.
Parameters are evaluated using a provided
QgsProcessingContext
, allowing the evaluation to understand
available map layers and expression contexts (for expression based
parameters).
Static Methods
Creates an autogenerated parameter description from a parameter name. |
|
Returns |
|
Evaluates the parameter with matching definition to an annotation layer. |
|
Evaluates the parameter with matching definition to a static boolean value. |
|
Evaluates the parameter with matching definition to a static boolean value. |
|
Returns the color associated with an point parameter value, or an invalid color if the parameter was not set. |
|
Evaluates the parameter with matching definition to a source vector layer file path of compatible format. |
|
Evaluates the parameter with matching definition to a source vector layer file path and layer name of compatible format. |
|
Evaluates the parameter with matching definition to a connection name string. |
|
Evaluates the parameter with matching definition to a coordinate reference system. |
|
Evaluates the parameter with matching definition to a database table name. |
|
Evaluates the parameter with matching definition to a static date value. |
|
Evaluates the parameter with matching definition to a static datetime value. |
|
Evaluates the parameter with matching definition to a static double value. |
|
Evaluates the parameter with matching definition to a enum value. |
|
Evaluates the parameter with matching definition to a static enum string. |
|
Evaluates the parameter with matching definition to list of static enum strings. |
|
Evaluates the parameter with matching definition to list of enum values. |
|
Evaluates the parameter with matching definition to an expression. |
|
Evaluates the parameter with matching definition to a rectangular extent. |
|
Returns the coordinate reference system associated with an extent parameter value. |
|
Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry covering this extent. |
|
Evaluates the parameter with matching definition to a list of fields. |
|
Evaluates the parameter with matching definition to a file/folder name. |
|
Evaluates the parameter with matching definition to a list of files (for |
|
Evaluates the parameter with matching definition to a file based output destination. |
|
Evaluates the parameter with matching definition to a geometry. |
|
Returns the coordinate reference system associated with a geometry parameter value. |
|
Evaluates the parameter with matching definition to a static integer value. |
|
Evaluates the parameter with matching definition to a list of integer values. |
|
Evaluates the parameter with matching definition to a map layer. |
|
Evaluates the parameter with matching definition to a list of map layers. |
|
Evaluates the parameter with matching definition to a print layout. |
|
Evaluates the parameter with matching definition to a print layout item, taken from the specified layout. |
|
Evaluates the parameter with matching definition to a matrix/table of values. |
|
Evaluates the parameter with matching definition and value to a mesh layer. |
|
Evaluates the parameter with matching definition to a output layer destination. |
|
Evaluates the parameter with matching definition to a point. |
|
Evaluates the parameter with matching definition to a point cloud layer. |
|
Returns the coordinate reference system associated with an point parameter value. |
|
Evaluates the parameter with matching definition to a range of values. |
|
Evaluates the parameter with matching definition to a raster layer. |
|
Evaluates the parameter with matching definition to a database schema name. |
|
Evaluates the parameter with matching definition to a feature sink. |
|
Evaluates the parameter with matching definition to a feature source. |
|
Evaluates the parameter with matching definition to a static string value. |
|
Evaluates the parameter with matching definition to a list of strings (e.g. field names or point cloud attributes). |
|
Evaluates the parameter with matching definition to a static time value. |
|
Evaluates the parameter with matching definition to a vector layer. |
|
Creates a new |
|
Creates a new |
- class qgis.core.QgsProcessingParameters[source]¶
Bases:
object
- static descriptionFromName(name: str | None) str [source]¶
Creates an autogenerated parameter description from a parameter
name
.- Parameters:
name (Optional[str])
- Return type:
str
- static isDynamic(parameters: Dict[str, Any], name: str | None) bool [source]¶
Returns
True
if the parameter with matchingname
is a dynamic parameter, and must be evaluated once for every input feature processed.- Parameters:
parameters (Dict[str, Any])
name (Optional[str])
- Return type:
bool
- static parameterAsAnnotationLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsAnnotationLayer | None [source]¶
Evaluates the parameter with matching
definition
to an annotation layer.Layers will be taken from
context
’s active project. Callers do not need to handle deletion of the returned layer.Warning
Working with annotation layers is generally not thread safe (unless the layers are from a
QgsProject
loaded directly in a background thread). Ensure your algorithm returns theQgsProcessingAlgorithm
.FlagNoThreading flag or only accesses annotation layers from aprepareAlgorithm()
orpostProcessAlgorithm()
step.Added in version 3.22.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
Optional[QgsAnnotationLayer]
- static parameterAsAnnotationLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsAnnotationLayer | None [source]
Evaluates the parameter with matching
definition
andvalue
to an annotation layer.Layers will be taken from
context
’s active project. Callers do not need to handle deletion of the returned layer.Warning
Working with annotation layers is generally not thread safe (unless the layers are from a
QgsProject
loaded directly in a background thread). Ensure your algorithm returns theQgsProcessingAlgorithm
.FlagNoThreading flag or only accesses annotation layers from aprepareAlgorithm()
orpostProcessAlgorithm()
step.Added in version 3.22.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
Optional[QgsAnnotationLayer]
- static parameterAsBool(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) bool [source]¶
Evaluates the parameter with matching
definition
to a static boolean value.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
bool
- static parameterAsBool(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) bool [source]
Evaluates the parameter with matching
definition
andvalue
to a static boolean value.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
bool
- static parameterAsBoolean(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) bool [source]¶
Evaluates the parameter with matching
definition
to a static boolean value.Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
bool
- static parameterAsBoolean(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) bool [source]
Evaluates the parameter with matching
definition
andvalue
to a static boolean value.Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
bool
- static parameterAsColor(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QColor [source]¶
Returns the color associated with an point parameter value, or an invalid color if the parameter was not set.
Added in version 3.10.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
QColor
- static parameterAsColor(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QColor [source]
Returns the color associated with an color parameter value, or an invalid color if the parameter was not set.
Added in version 3.10.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
QColor
- static parameterAsCompatibleSourceLayerPath(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, compatibleFormats: Iterable[str | None], preferredFormat: str | None = '', feedback: QgsProcessingFeedback | None = None) str [source]¶
Evaluates the parameter with matching
definition
to a source vector layer file path of compatible format.If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the
compatibleFormats
argument, then the layer will first be exported to a compatible format in a temporary location. The function will then return the path to that temporary file.compatibleFormats
should consist entirely of lowercase file extensions, e.g. ‘shp’.The
preferredFormat
argument is used to specify to desired file extension to use when a temporary layer export is required. This defaults to shapefiles, because shapefiles are the future (don’t believe the geopackage hype!).When an algorithm is capable of handling multi-layer input files (such as Geopackage), it is preferable to use
parameterAsCompatibleSourceLayerPathAndLayerName()
which may avoid conversion in more situations.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (QgsProcessingContext)
compatibleFormats (Iterable[Optional[str]])
preferredFormat (Optional[str] = '')
feedback (Optional[QgsProcessingFeedback] = None)
- Return type:
str
- static parameterAsCompatibleSourceLayerPathAndLayerName(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, compatibleFormats: Iterable[str | None], preferredFormat: str | None = '', feedback: QgsProcessingFeedback | None = None)[source]¶
Evaluates the parameter with matching
definition
to a source vector layer file path and layer name of compatible format.If the parameter is evaluated to an existing layer, and that layer is not of the format listed in the
compatibleFormats
argument, then the layer will first be exported to a compatible format in a temporary location. The function will then return the path to that temporary file.compatibleFormats
should consist entirely of lowercase file extensions, e.g. ‘shp’.The
preferredFormat
argument is used to specify to desired file extension to use when a temporary layer export is required. This defaults to shapefiles, because shapefiles are the future (don’t believe the geopackage hype!).This method should be preferred over
parameterAsCompatibleSourceLayerPath()
when an algorithm is able to correctly handle files with multiple layers. UnlikeparameterAsCompatibleSourceLayerPath()
, it will not force a conversion in this case and will return the target layer name in thelayerName
argument.- Parameters:
definition (Optional[QgsProcessingParameterDefinition]) – associated parameter definition
parameters (Dict[str, Any]) – input parameter value map
context (QgsProcessingContext) – processing context
compatibleFormats (Iterable[Optional[str]]) – a list of lowercase file extensions compatible with the algorithm
preferredFormat (Optional[str] = '') – preferred format extension to use if conversion if required
feedback (Optional[QgsProcessingFeedback] = None) -> (str) – feedback object
- Returns:
path to source layer, or nearly converted compatible layer
layerName: the target layer name for multi-layer sources (e.g. Geopackage)
Added in version 3.10.
- static parameterAsConnectionName(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a connection name string.Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsConnectionName(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a connection name string.Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsCrs(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]¶
Evaluates the parameter with matching
definition
to a coordinate reference system.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
- static parameterAsCrs(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]
Evaluates the parameter with matching
definition
andvalue
to a coordinate reference system.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
- static parameterAsDatabaseTableName(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a database table name.Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsDatabaseTableName(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a database table name.Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsDate(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QDate [source]¶
Evaluates the parameter with matching
definition
to a static date value.See also
See also
Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
QDate
- static parameterAsDate(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QDate [source]
Evaluates the parameter with matching
definition
andvalue
to a static date value.See also
See also
Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
QDate
- static parameterAsDateTime(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QDateTime [source]¶
Evaluates the parameter with matching
definition
to a static datetime value.See also
See also
Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
QDateTime
- static parameterAsDateTime(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QDateTime [source]
Evaluates the parameter with matching
definition
andvalue
to a static datetime value.See also
See also
Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
QDateTime
- static parameterAsDouble(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) float [source]¶
Evaluates the parameter with matching
definition
to a static double value.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
float
- static parameterAsDouble(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) float [source]
Evaluates the parameter with matching
definition
andvalue
to a static double value.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
float
- static parameterAsEnum(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) int [source]¶
Evaluates the parameter with matching
definition
to a enum value.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
int
- static parameterAsEnum(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) int [source]
Evaluates the parameter with matching
definition
andvalue
to a enum value.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
int
- static parameterAsEnumString(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a static enum string.Added in version 3.18.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsEnumString(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a static enum string.Added in version 3.18.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsEnumStrings(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[str] [source]¶
Evaluates the parameter with matching
definition
to list of static enum strings.Added in version 3.18.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsEnumStrings(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[str] [source]
Evaluates the parameter with matching
definition
andvalue
to list of static enum strings.Added in version 3.18.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsEnums(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[int] ¶
Evaluates the parameter with matching
definition
to list of enum values.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[int]
- static parameterAsEnums(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[int]
Evaluates the parameter with matching
definition
andvalue
to list of enum values.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[int]
- static parameterAsExpression(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to an expression.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsExpression(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definitionand
value
to an expression.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsExtent(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsRectangle [source]¶
Evaluates the parameter with matching
definition
to a rectangular extent.If
crs
is set, and the original coordinate reference system of the parameter can be determined, then the extent will be automatically reprojected so that it is in the specifiedcrs
. In this case the extent of the reproject rectangle will be returned.See also
See also
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsExtent(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsRectangle [source]
Evaluates the parameter with matching
definition
andvalue
to a rectangular extent.If
crs
is set, and the original coordinate reference system of the parameter can be determined, then the extent will be automatically reprojected so that it is in the specifiedcrs
. In this case the extent of the reproject rectangle will be returned.See also
See also
Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsExtentCrs(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]¶
Returns the coordinate reference system associated with an extent parameter value.
See also
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
- static parameterAsExtentCrs(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]
Returns the coordinate reference system associated with an extent parameter value.
See also
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
- static parameterAsExtentGeometry(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsGeometry [source]¶
Evaluates the parameter with matching
definition
to a rectangular extent, and returns a geometry covering this extent.If
crs
is set, and the original coordinate reference system of the parameter can be determined, then the extent will be automatically reprojected so that it is in the specifiedcrs
. UnlikeparameterAsExtent()
, the reprojected rectangle returned by this function will no longer be a rectangle itself (i.e. this method returns the geometry of the actual reprojected rectangle, whileparameterAsExtent()
returns just the extent of the reprojected rectangle).See also
See also
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (QgsProcessingContext)
crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsFields(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[str] [source]¶
Evaluates the parameter with matching
definition
to a list of fields.Deprecated since version 3.40: Use
parameterAsStrings()
instead.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsFields(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[str] [source]
Evaluates the parameter with matching
definition
andvalue
to a list of fields.Added in version 3.4.
Deprecated since version 3.40: Use
parameterAsStrings()
instead.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsFile(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a file/folder name.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsFile(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a file/folder name.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsFileList(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[str] [source]¶
Evaluates the parameter with matching
definition
to a list of files (forQgsProcessingParameterMultipleLayers
inQgsProcessing
:TypeFile mode).Added in version 3.10.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsFileList(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[str] [source]
Evaluates the parameter with matching
definition
to a list of files (forQgsProcessingParameterMultipleLayers
inQgsProcessing
:TypeFile mode).Added in version 3.10.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsFileOutput(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a file based output destination.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsFileOutput(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a file based output destination.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsGeometry(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsGeometry [source]¶
Evaluates the parameter with matching
definition
to a geometry.Added in version 3.16.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsGeometry(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsGeometry [source]
Evaluates the parameter with matching
definition
andvalue
to a geometry.Added in version 3.16.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsGeometryCrs(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]¶
Returns the coordinate reference system associated with a geometry parameter value.
See also
Added in version 3.16.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
- static parameterAsGeometryCrs(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]
Returns the coordinate reference system associated with an point parameter value.
See also
Added in version 3.16.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
- static parameterAsInt(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) int [source]¶
Evaluates the parameter with matching
definition
to a static integer value.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
int
- static parameterAsInt(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) int [source]
Evaluates the parameter with matching
definition
andvalue
to a static integer value.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
int
- static parameterAsInts(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[int] ¶
Evaluates the parameter with matching
definition
to a list of integer values.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[int]
- static parameterAsInts(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[int]
Evaluates the parameter with matching
definition
andvalue
to a list of integer values.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[int]
- static parameterAsLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, layerHint: QgsProcessingUtils.LayerHint = QgsProcessingUtils.LayerHint.UnknownType, flags: QgsProcessing.LayerOptionsFlags | QgsProcessing.LayerOptionsFlag = QgsProcessing.LayerOptionsFlags()) QgsMapLayer | None [source]¶
Evaluates the parameter with matching
definition
to a map layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)layerHint (QgsProcessingUtils.LayerHint = QgsProcessingUtils.LayerHint.UnknownType)
flags (Union[QgsProcessing.LayerOptionsFlags, QgsProcessing.LayerOptionsFlag] = QgsProcessing.LayerOptionsFlags())
- Return type:
Optional[QgsMapLayer]
- static parameterAsLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, layerHint: QgsProcessingUtils.LayerHint = QgsProcessingUtils.LayerHint.UnknownType, flags: QgsProcessing.LayerOptionsFlags | QgsProcessing.LayerOptionsFlag = QgsProcessing.LayerOptionsFlags()) QgsMapLayer | None [source]
Evaluates the parameter with matching
definition
andvalue
to a map layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)layerHint (QgsProcessingUtils.LayerHint = QgsProcessingUtils.LayerHint.UnknownType)
flags (Union[QgsProcessing.LayerOptionsFlags, QgsProcessing.LayerOptionsFlag] = QgsProcessing.LayerOptionsFlags())
- Return type:
Optional[QgsMapLayer]
- static parameterAsLayerList(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, flags: QgsProcessing.LayerOptionsFlags | QgsProcessing.LayerOptionsFlag = QgsProcessing.LayerOptionsFlags()) List[QgsMapLayer] ¶
Evaluates the parameter with matching
definition
to a list of map layers. Theflags
are used to set options for loading layers (e.g. skip index generation).- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)flags (Union[QgsProcessing.LayerOptionsFlags, QgsProcessing.LayerOptionsFlag] = QgsProcessing.LayerOptionsFlags())
- Return type:
List[QgsMapLayer]
- static parameterAsLayerList(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, flags: QgsProcessing.LayerOptionsFlags | QgsProcessing.LayerOptionsFlag = QgsProcessing.LayerOptionsFlags()) List[QgsMapLayer]
Evaluates the parameter with matching
definition
andvalue
to a list of map layers. Theflags
are used to set options for loading layers (e.g. skip index generation).Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)flags (Union[QgsProcessing.LayerOptionsFlags, QgsProcessing.LayerOptionsFlag] = QgsProcessing.LayerOptionsFlags())
- Return type:
List[QgsMapLayer]
- static parameterAsLayout(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsPrintLayout | None [source]¶
Evaluates the parameter with matching
definition
to a print layout.Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
Optional[QgsPrintLayout]
- static parameterAsLayout(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsPrintLayout | None [source]
Evaluates the parameter with matching
definition
andvalue
to a print layout.Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
Optional[QgsPrintLayout]
- static parameterAsLayoutItem(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, layout: QgsPrintLayout | None) QgsLayoutItem | None [source]¶
Evaluates the parameter with matching
definition
to a print layout item, taken from the specifiedlayout
.Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)layout (Optional[QgsPrintLayout])
- Return type:
Optional[QgsLayoutItem]
- static parameterAsLayoutItem(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, layout: QgsPrintLayout | None) QgsLayoutItem | None [source]
Evaluates the parameter with matching
definition
andvalue
to a print layout, taken from the specifiedlayout
.Warning
This method is not safe to run in a background thread, so it must either be used within a prepareAlgorithm implementation (which runs in the main thread), or the algorithm must return the FlagNoThreading flag.
Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)layout (Optional[QgsPrintLayout])
- Return type:
Optional[QgsLayoutItem]
- static parameterAsMatrix(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[Any] [source]¶
Evaluates the parameter with matching
definition
to a matrix/table of values. Tables are collapsed to a 1 dimensional list.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[Any]
- static parameterAsMatrix(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[Any] [source]
Evaluates the parameter with matching
definition
andvalue
to a matrix/table of values. Tables are collapsed to a 1 dimensional list.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[Any]
- static parameterAsMeshLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsMeshLayer | None [source]¶
Evaluates the parameter with matching
definition
andvalue
to a mesh layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.6.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
Optional[QgsMeshLayer]
- static parameterAsMeshLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsMeshLayer | None [source]
Evaluates the parameter with matching
definition
andvalue
to a mesh layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.6.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
Optional[QgsMeshLayer]
- static parameterAsOutputLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a output layer destination.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsOutputLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, testOnly: bool = False) str [source]
Evaluates the parameter with matching
definition
andvalue
to a output layer destination.Since QGIS 3.38 the
testOnly
argument can be set toTrue
to evaluate the parameter to an output layer destination for advance testing only. This prevents default behavior such as output post-processing which would otherwise occur.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)testOnly (bool = False)
- Return type:
str
- static parameterAsPoint(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsPointXY [source]¶
Evaluates the parameter with matching
definition
to a point.If
crs
is set then the point will be automatically reprojected so that it is in the specifiedcrs
.See also
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsPoint(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) QgsPointXY [source]
Evaluates the parameter with matching
definition
andvalue
to a point.If
crs
is set then the point will be automatically reprojected so that it is in the specifiedcrs
.See also
Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)crs (
QgsCoordinateReferenceSystem
= QgsCoordinateReferenceSystem())
- Return type:
- static parameterAsPointCloudLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext, flags: QgsProcessing.LayerOptionsFlags | QgsProcessing.LayerOptionsFlag = QgsProcessing.LayerOptionsFlags()) QgsPointCloudLayer | None [source]¶
Evaluates the parameter with matching
definition
to a point cloud layer. Theflags
are used to set options for loading layer (e.g. skip index generation).Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.22.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)flags (Union[QgsProcessing.LayerOptionsFlags, QgsProcessing.LayerOptionsFlag] = QgsProcessing.LayerOptionsFlags())
- Return type:
Optional[QgsPointCloudLayer]
- static parameterAsPointCloudLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext, flags: QgsProcessing.LayerOptionsFlags | QgsProcessing.LayerOptionsFlag = QgsProcessing.LayerOptionsFlags()) QgsPointCloudLayer | None [source]
Evaluates the parameter with matching
definition
andvalue
to a point cloud layer. Theflags
are used to set options for loading layer (e.g. skip index generation).Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.22.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)flags (Union[QgsProcessing.LayerOptionsFlags, QgsProcessing.LayerOptionsFlag] = QgsProcessing.LayerOptionsFlags())
- Return type:
Optional[QgsPointCloudLayer]
- static parameterAsPointCrs(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]¶
Returns the coordinate reference system associated with an point parameter value.
See also
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
- static parameterAsPointCrs(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsCoordinateReferenceSystem [source]
Returns the coordinate reference system associated with an point parameter value.
See also
Added in version 3.8.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
- static parameterAsRange(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[float] ¶
Evaluates the parameter with matching
definition
to a range of values.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[float]
- static parameterAsRange(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[float]
Evaluates the parameter with matching
definition
andvalue
to a range of values.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[float]
- static parameterAsRasterLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsRasterLayer | None [source]¶
Evaluates the parameter with matching
definition
to a raster layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
Optional[QgsRasterLayer]
- static parameterAsRasterLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsRasterLayer | None [source]
Evaluates the parameter with matching
definition
andvalue
to a raster layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
Optional[QgsRasterLayer]
- static parameterAsSchema(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a database schema name.Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsSchema(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a database schema name.Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsSink(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], fields: QgsFields, geometryType: Qgis.WkbType, crs: QgsCoordinateReferenceSystem, context: QgsProcessingContext, sinkFlags: QgsFeatureSink.SinkFlags | QgsFeatureSink.SinkFlag = QgsFeatureSink.SinkFlags(), createOptions: Dict[str, Any] = {}, datasourceOptions: Iterable[str | None] = [], layerOptions: Iterable[str | None] = [])[source]¶
Evaluates the parameter with matching
definition
to a feature sink.The
fields
,geometryType
andcrs
parameters dictate the properties of the resulting feature sink.Sinks will either be taken from
context
’s active project, or created from external providers and stored temporarily in thecontext
. ThedestinationIdentifier
argument will be set to a string which can be used to retrieve the layer corresponding to the sink, e.g. via callingQgsProcessingUtils.mapLayerFromString()
.The
createOptions
argument is used to pass on creation options such as layer name.The
datasourceOptions
andlayerOptions
arguments is used to pass on GDAL-specific format driver options.This function creates a new object and the caller takes responsibility for deleting the returned object.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
fields (
QgsFields
)geometryType (Qgis.WkbType)
context (
QgsProcessingContext
)sinkFlags (Union[QgsFeatureSink.SinkFlags, QgsFeatureSink.SinkFlag] = QgsFeatureSink.SinkFlags())
createOptions (Dict[str, Any] = {})
datasourceOptions (Iterable[Optional[str]] = [])
layerOptions (Iterable[Optional[str]] = []) -> (Optional[QgsFeatureSink])
- static parameterAsSink(definition: QgsProcessingParameterDefinition | None, value: Any, fields: QgsFields, geometryType: Qgis.WkbType, crs: QgsCoordinateReferenceSystem, context: QgsProcessingContext, sinkFlags: QgsFeatureSink.SinkFlags | QgsFeatureSink.SinkFlag = QgsFeatureSink.SinkFlags(), createOptions: Dict[str, Any] = {}, datasourceOptions: Iterable[str | None] = [], layerOptions: Iterable[str | None] = [])[source]
Evaluates the parameter with matching
definition
andvalue
to a feature sink.The
fields
,geometryType
andcrs
parameters dictate the properties of the resulting feature sink.Sinks will either be taken from
context
’s active project, or created from external providers and stored temporarily in thecontext
. ThedestinationIdentifier
argument will be set to a string which can be used to retrieve the layer corresponding to the sink, e.g. via callingQgsProcessingUtils.mapLayerFromString()
.The
createOptions
argument is used to pass on creation options such as layer name.The
datasourceOptions
andlayerOptions
arguments is used to pass on GDAL-specific format driver options.This function creates a new object and the caller takes responsibility for deleting the returned object.
- Raises:
Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
fields (
QgsFields
)geometryType (Qgis.WkbType)
context (
QgsProcessingContext
)sinkFlags (Union[QgsFeatureSink.SinkFlags, QgsFeatureSink.SinkFlag] = QgsFeatureSink.SinkFlags())
createOptions (Dict[str, Any] = {})
datasourceOptions (Iterable[Optional[str]] = [])
layerOptions (Iterable[Optional[str]] = []) -> (Optional[QgsFeatureSink])
- static parameterAsSource(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsProcessingFeatureSource | None [source]¶
Evaluates the parameter with matching
definition
to a feature source.Sources will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
.This function creates a new object and the caller takes responsibility for deleting the returned object.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
Optional[QgsProcessingFeatureSource]
- static parameterAsSource(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsProcessingFeatureSource | None [source]
Evaluates the parameter with matching
definition
andvalue
to a feature source.Sources will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
.This function creates a new object and the caller takes responsibility for deleting the returned object.
Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
Optional[QgsProcessingFeatureSource]
- static parameterAsString(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) str [source]¶
Evaluates the parameter with matching
definition
to a static string value.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsString(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) str [source]
Evaluates the parameter with matching
definition
andvalue
to a static string value.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
str
- static parameterAsStrings(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) List[str] [source]¶
Evaluates the parameter with matching
definition
to a list of strings (e.g. field names or point cloud attributes).Added in version 3.32.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsStrings(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) List[str] [source]
Evaluates the parameter with matching
definition
andvalue
to a list of strings (e.g. field names or point cloud attributes).Added in version 3.32.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
List[str]
- static parameterAsTime(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QTime [source]¶
Evaluates the parameter with matching
definition
to a static time value.See also
See also
Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
QTime
- static parameterAsTime(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QTime [source]
Evaluates the parameter with matching
definition
andvalue
to a static time value.See also
See also
Added in version 3.14.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
QTime
- static parameterAsVectorLayer(definition: QgsProcessingParameterDefinition | None, parameters: Dict[str, Any], context: QgsProcessingContext) QgsVectorLayer | None [source]¶
Evaluates the parameter with matching
definition
to a vector layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
parameters (Dict[str, Any])
context (
QgsProcessingContext
)
- Return type:
Optional[QgsVectorLayer]
- static parameterAsVectorLayer(definition: QgsProcessingParameterDefinition | None, value: Any, context: QgsProcessingContext) QgsVectorLayer | None [source]
Evaluates the parameter with matching
definition
andvalue
to a vector layer.Layers will either be taken from
context
’s active project, or loaded from external sources and stored temporarily in thecontext
. In either case, callers do not need to handle deletion of the returned layer.Added in version 3.4.
- Parameters:
definition (Optional[QgsProcessingParameterDefinition])
value (Any)
context (
QgsProcessingContext
)
- Return type:
Optional[QgsVectorLayer]
- static parameterFromScriptCode(code: str | None) QgsProcessingParameterDefinition | None [source]¶
Creates a new
QgsProcessingParameterDefinition
using the configuration from a supplied scriptcode
string. The caller takes responsibility for deleting the returned object.- Parameters:
code (Optional[str])
- Return type:
Optional[QgsProcessingParameterDefinition]
- static parameterFromVariantMap(map: Dict[str, Any]) QgsProcessingParameterDefinition | None [source]¶
Creates a new
QgsProcessingParameterDefinition
using the configuration from a supplied variantmap
. The caller takes responsibility for deleting the returned object.- Parameters:
map (Dict[str, Any])
- Return type:
Optional[QgsProcessingParameterDefinition]