Class: QgsProcessingRasterLayerDefinition

Encapsulates settings relating to a raster layer input to a processing algorithm.

Added in version 4.0.

Methods

loadVariant

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

toVariant

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

Attributes

dpi

Indicates the resolution of the raster source (e.g., a WMS server).

referenceScale

If set to a value > 0, sets a scale at which a raster (e.g., a WMS) should be requested or rendered.

source

Source definition.

class qgis.core.QgsProcessingRasterLayerDefinition[source]

Bases: object

__init__(source: str | None = '', referenceScale: float = 0, dpi: int = 96)

Constructor for QgsProcessingRasterLayerDefinition, accepting a static string source.

The optional referenceScale can be set to a value > 0 to indicate the reference scale at which a raster layer should be requested or rendered. For instance, a WMS image.

The optional dpi argument can be used to specify the resolution a raster provider (e.g., a WMS server) is using to generate the raster.

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

  • referenceScale (float = 0)

  • dpi (int = 96)

__init__(source: QgsProperty, referenceScale: float = 0, dpi: int = 96)

Constructor for QgsProcessingRasterLayerDefinition, accepting a QgsProperty source.

The optional referenceScale can be set to a value > 0 to indicate the reference scale at which a raster layer should be requested or rendered. For instance, a WMS image.

The optional dpi argument can be used to specify the resolution a raster provider (e.g., a WMS server) is using to generate the raster.

Parameters:
  • source (QgsProperty)

  • referenceScale (float = 0)

  • dpi (int = 96)

__init__(a0: QgsProcessingRasterLayerDefinition)
Parameters:

a0 (QgsProcessingRasterLayerDefinition)

dpi: int

Indicates the resolution of the raster source (e.g., a WMS server). By default 96 DPI.

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

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

See also

toVariant()

Parameters:

map (Dict[str, Any])

Return type:

bool

referenceScale: float

If set to a value > 0, sets a scale at which a raster (e.g., a WMS) should be requested or rendered.

source: QgsProperty

Source definition. Usually a static property set to a source layer’s ID or file name.

toVariant(self) Any[source]

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

See also

loadVariant()

Return type:

Any