Class: QgsRasterLayerElevationProperties

Raster layer specific subclass of QgsMapLayerElevationProperties.

Added in version 3.26.

Class Hierarchy

Inheritance diagram of qgis.core.QgsRasterLayerElevationProperties

Base classes

QgsMapLayerElevationProperties

Base class for storage of map layer elevation properties.

QObject

class qgis.core.QgsRasterLayerElevationProperties[source]

Bases: QgsMapLayerElevationProperties

__init__(parent: QObject | None)

Constructor for QgsRasterLayerElevationProperties, with the specified parent object.

Parameters:

parent (Optional[QObject])

bandForElevationRange(self, layer: QgsRasterLayer | None, range: QgsDoubleRange) int[source]

Returns the band corresponding to the specified range.

Note

This is only considered when mode() is Qgis.RasterElevationMode.FixedRangePerBand or Qgis.RasterElevationMode.DynamicRangePerBand. For other modes it will always return -1.

Added in version 3.38.

Parameters:
Return type:

int

bandNumber(self) int[source]

Returns the band number from which the elevation should be taken.

Note

This is only considered when mode() is Qgis.RasterElevationMode.RepresentsElevationSurface.

See also

setBandNumber()

Return type:

int

elevationLimit(self) float[source]

Returns the elevation limit, which is used when profileSymbology() is Qgis.ProfileSurfaceSymbology.FillBelow or Qgis.ProfileSurfaceSymbology.FillAbove to limit the fill to a specific elevation range.

By default this is NaN, which indicates that there is no elevation limit.

Added in version 3.32.

Return type:

float

elevationRangeForPixelValue(self, layer: QgsRasterLayer | None, band: int, pixelValue: float) QgsDoubleRange[source]

Returns the elevation range corresponding to a raw pixel value from the specified band.

Returns an infinite range if the pixel value does not correspond to an elevation value.

Added in version 3.38.

Parameters:
Return type:

QgsDoubleRange

fixedRange(self) QgsDoubleRange[source]

Returns the fixed elevation range for the raster.

Note

This is only considered when mode() is Qgis.RasterElevationMode.FixedElevationRange.

Note

When a fixed range is set any zOffset() and zScale() is ignored.

See also

setFixedRange()

Added in version 3.38.

Return type:

QgsDoubleRange

fixedRangePerBand(self) Dict[int, QgsDoubleRange]

Returns the fixed elevation range for each band.

Note

This is only considered when mode() is Qgis.RasterElevationMode.FixedRangePerBand.

Note

When a fixed range is set any zOffset() and zScale() is ignored.

Added in version 3.38.

Return type:

Dict[int, QgsDoubleRange]

isEnabled(self) bool[source]

Returns True if the elevation properties are enabled, i.e. the raster layer values represent an elevation surface.

See also

setEnabled()

Return type:

bool

static layerLooksLikeDem(layer: QgsRasterLayer | None) bool[source]

Returns True if a raster layer looks like a DEM.

This method applies some heuristics to layer to determine whether it looks like a candidate for a DEM layer.

Specifically, it checks:

  • the layer’s name for DEM-like wording hints

  • whether the layer contains a single band

  • whether the layer contains an attribute table (if so, it’s unlikely to be a DEM)

  • the layer’s data type

Added in version 3.32.

Parameters:

layer (Optional[QgsRasterLayer])

Return type:

bool

mode(self) Qgis.RasterElevationMode[source]

Returns the elevation mode.

See also

setMode()

Added in version 3.38.

Return type:

Qgis.RasterElevationMode

profileFillSymbol(self) QgsFillSymbol | None[source]

Returns the fill symbol used to render the raster profile in elevation profile plots.

Return type:

Optional[QgsFillSymbol]

profileLineSymbol(self) QgsLineSymbol | None[source]

Returns the line symbol used to render the raster profile in elevation profile plots.

Return type:

Optional[QgsLineSymbol]

profileSymbology(self) Qgis.ProfileSurfaceSymbology[source]

Returns the symbology option used to render the raster profile in elevation profile plots.

Return type:

Qgis.ProfileSurfaceSymbology

setBandNumber(self, band: int)[source]

Sets the band number from which the elevation should be taken.

Note

This is only considered when mode() is Qgis.RasterElevationMode.RepresentsElevationSurface.

See also

bandNumber()

Parameters:

band (int)

setElevationLimit(self, limit: float)[source]

Sets the elevation limit, which is used when profileSymbology() is Qgis.ProfileSurfaceSymbology.FillBelow or Qgis.ProfileSurfaceSymbology.FillAbove to limit the fill to a specific elevation range.

Set to NaN to indicate that there is no elevation limit.

See also

elevationLimit()

Added in version 3.32.

Parameters:

limit (float)

setEnabled(self, enabled: bool)[source]

Sets whether the elevation properties are enabled, i.e. the raster layer values represent an elevation surface.

See also

isEnabled()

Parameters:

enabled (bool)

setFixedRange(self, range: QgsDoubleRange)[source]

Sets the fixed elevation range for the raster.

Note

This is only considered when mode() is Qgis.RasterElevationMode.FixedElevationRange.

Note

When a fixed range is set any zOffset() and zScale() is ignored.

See also

fixedRange()

Added in version 3.38.

Parameters:

range (QgsDoubleRange)

setFixedRangePerBand(self, ranges: Dict[int, QgsDoubleRange])[source]

Sets the fixed elevation range for each band.

Note

This is only considered when mode() is Qgis.RasterElevationMode.FixedRangePerBand.

Note

When a fixed range is set any zOffset() and zScale() is ignored.

Added in version 3.38.

Parameters:

ranges (Dict[int, QgsDoubleRange])

setMode(self, mode: Qgis.RasterElevationMode)[source]

Sets the elevation mode.

See also

mode()

Added in version 3.38.

Parameters:

mode (Qgis.RasterElevationMode)

setProfileFillSymbol(self, symbol: QgsFillSymbol | None)[source]

Sets the fill symbol used to render the raster profile in elevation profile plots.

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsFillSymbol])

setProfileLineSymbol(self, symbol: QgsLineSymbol | None)[source]

Sets the line symbol used to render the raster profile in elevation profile plots.

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsLineSymbol])

setProfileSymbology(self, symbology: Qgis.ProfileSurfaceSymbology)[source]

Sets the symbology option used to render the raster profile in elevation profile plots.

Parameters:

symbology (Qgis.ProfileSurfaceSymbology)