Class: QgsProcessingOutputLayerDefinition

Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.

Methods

loadVariant

Loads this output layer definition from a QVariantMap, wrapped in a QVariant.

remappingDefinition

Returns the output remapping definition, if useRemapping() is True.

setRemappingDefinition

Sets the remapping definition to use when adding features to the output layer.

toVariant

Saves this output layer definition to a QVariantMap, wrapped in a QVariant.

useRemapping

Returns True if the output uses a remapping definition.

Attributes

createOptions

Map of optional sink/layer creation options, which are passed to the underlying provider when creating new layers.

destinationName

Name to use for sink if it's to be loaded into a destination project.

destinationProject

Destination project.

sink

Sink/layer definition.

class qgis.core.QgsProcessingOutputLayerDefinition[source]

Bases: object

__init__(sink: str | None = '', destinationProject: QgsProject | None = None)

Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string. The destinationProject parameter can be set to a QgsProject instance in which to automatically load the resulting sink/layer after completing processing.

Parameters:
  • sink (Optional[str] = '')

  • destinationProject (Optional[QgsProject] = None)

__init__(sink: QgsProperty, destinationProject: QgsProject | None = None)

Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer. The destinationProject parameter can be set to a QgsProject instance in which to automatically load the resulting sink/layer after completing processing.

Parameters:
__init__(a0: QgsProcessingOutputLayerDefinition)
Parameters:

a0 (QgsProcessingOutputLayerDefinition)

createOptions: Dict[str, object]

Map of optional sink/layer creation options, which are passed to the underlying provider when creating new layers. Known options also include ‘fileEncoding’, which is used to specify a file encoding to use for created files.

destinationName: str

Name to use for sink if it’s to be loaded into a destination project.

destinationProject: QgsProject

Destination project. Can be set to a QgsProject instance in which to automatically load the resulting sink/layer after completing processing. The default behavior is not to load the result into any project (None).

loadVariant(self, map: Dict[str, Any]) bool[source]

Loads this output layer definition from a QVariantMap, wrapped in a QVariant. You can use QgsXmlUtils.readVariant to load it from an XML document.

See also

toVariant()

Added in version 3.2.

Parameters:

map (Dict[str, Any])

Return type:

bool

remappingDefinition(self) QgsRemappingSinkDefinition[source]

Returns the output remapping definition, if useRemapping() is True.

See also

useRemapping()

Added in version 3.14.

Return type:

QgsRemappingSinkDefinition

setRemappingDefinition(self, definition: QgsRemappingSinkDefinition)[source]

Sets the remapping definition to use when adding features to the output layer.

Calling this method will set useRemapping() to True.

See also

useRemapping()

Added in version 3.14.

Parameters:

definition (QgsRemappingSinkDefinition)

sink: QgsProperty

Sink/layer definition. Usually a static property set to the destination file name for the sink’s layer.

toVariant(self) Any[source]

Saves this output layer definition to a QVariantMap, wrapped in a QVariant. You can use QgsXmlUtils.writeVariant to save it to an XML document.

See also

loadVariant()

Added in version 3.2.

Return type:

Any

useRemapping(self) bool[source]

Returns True if the output uses a remapping definition.

Added in version 3.14.

Return type:

bool