Class: QgsProcessingDestinationParameter

Base class for all parameter definitions which represent file or layer destinations, e.g. parameters which are used for the destination for layers output by an algorithm.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsProcessingParameterDefinition.clone(), defaultFileExtension(), toOutputDefinition(), QgsProcessingParameterDefinition.type()

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingDestinationParameter

Base classes

QgsProcessingParameterDefinition

Base class for the definition of processing parameters.

QgsFileFilterGenerator

Abstract interface for classes which generate a file filter string.

Subclasses

QgsProcessingParameterFeatureSink

A feature sink output for processing algorithms.

QgsProcessingParameterFileDestination

A generic file based destination parameter, for specifying the destination path for a file (non-map layer) created by the algorithm.

QgsProcessingParameterFolderDestination

A folder destination parameter, for specifying the destination path for a folder created by the algorithm or used for creating new files within the algorithm.

QgsProcessingParameterPointCloudDestination

A point cloud layer destination parameter, for specifying the destination path for a point cloud layer created by the algorithm.

QgsProcessingParameterRasterDestination

A raster layer destination parameter, for specifying the destination path for a raster layer created by the algorithm.

QgsProcessingParameterVectorDestination

A vector layer destination parameter, for specifying the destination path for a vector layer created by the algorithm.

QgsProcessingParameterVectorTileDestination

A vector tile layer destination parameter, for specifying the destination path for a vector tile layer created by the algorithm.

Abstract Methods

defaultFileExtension

Returns the default file extension for destination file paths associated with this parameter.

toOutputDefinition

Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parameter.

Methods

createByDefault

Returns True if the destination should be created by default.

originalProvider

Original (source) provider which this parameter has been derived from.

setCreateByDefault

Sets whether the destination should be created by default.

setSupportsNonFileBasedOutput

Sets whether the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.

supportsNonFileBasedOutput

Returns True if the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsProcessingDestinationParameter. See the FAQ for more details.

generateTemporaryDestination

Generates a temporary destination value for this parameter.

isSupportedOutputValue

Tests whether a value is a supported value for this parameter.

class qgis.core.QgsProcessingDestinationParameter[source]

Bases: QgsProcessingParameterDefinition, QgsFileFilterGenerator

__init__(name: str | None, description: str | None = '', defaultValue: Any = None, optional: bool = False, createByDefault: bool = True)

Constructor for QgsProcessingDestinationParameter.

If createByDefault is False and the parameter is optional, then the destination output will not be created by default.

Parameters:
  • name (Optional[str])

  • description (Optional[str] = '')

  • defaultValue (Any = None)

  • optional (bool = False)

  • createByDefault (bool = True)

__init__(a0: QgsProcessingDestinationParameter)
Parameters:

a0 (QgsProcessingDestinationParameter)

createByDefault(self) bool[source]

Returns True if the destination should be created by default. For optional parameters, a return value of False indicates that the destination should not be created by default.

Return type:

bool

abstract defaultFileExtension(self) str[source]

Returns the default file extension for destination file paths associated with this parameter.

Return type:

str

virtual generateTemporaryDestination(self, context: QgsProcessingContext | None = None) str[source]

Generates a temporary destination value for this parameter. The returned value will be a file path or QGIS data provider URI suitable for temporary storage of created layers and files.

Parameters:

context (Optional[QgsProcessingContext] = None)

Return type:

str

virtual isSupportedOutputValue(self, value: Any, context: QgsProcessingContext)[source]

Tests whether a value is a supported value for this parameter.

Will return False when a value with an unsupported file extension is specified. The default implementation calls QgsProcessingProvider.isSupportedOutputValue() to test compatibility.

Parameters:
Returns:

  • True if value is supported.

  • error: a descriptive error string

Added in version 3.14.

originalProvider(self) QgsProcessingProvider | None[source]

Original (source) provider which this parameter has been derived from. In the case of destination parameters which are part of model algorithms, this will reflect the child algorithm’s provider which actually generates the parameter, as opposed to the provider which this parameter belongs to (i.e. the model provider)

Added in version 3.2.

Return type:

Optional[QgsProcessingProvider]

setCreateByDefault(self, createByDefault: bool)[source]

Sets whether the destination should be created by default. For optional parameters, a value of False indicates that the destination should not be created by default.

Parameters:

createByDefault (bool)

setSupportsNonFileBasedOutput(self, supportsNonFileBasedOutput: bool)[source]

Sets whether the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.

Parameters:

supportsNonFileBasedOutput (bool)

supportsNonFileBasedOutput(self) bool[source]

Returns True if the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.

Return type:

bool

abstract toOutputDefinition(self) QgsProcessingOutputDefinition | None[source]

Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parameter.

Return type:

Optional[QgsProcessingOutputDefinition]