Class: QgsRasterLayerElevationProperties

class qgis.core.QgsRasterLayerElevationProperties

Bases: QgsMapLayerElevationProperties

Raster layer specific subclass of QgsMapLayerElevationProperties.

New in version 3.26.

QgsRasterLayerElevationProperties(parent: QObject) Constructor for QgsRasterLayerElevationProperties, with the specified parent object.

Methods

bandNumber

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

calculateZRange

param layer:

childEvent

clone

rtype:

QgsRasterLayerElevationProperties

connectNotify

copyCommonProperties

Copies common properties from another object.

customEvent

disconnectNotify

elevationLimit

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.

elevationRangeForPixelValue

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

fixedRange

Returns the fixed elevation range for the raster.

fixedRangePerBand

Returns the fixed elevation range for each band.

hasElevation

rtype:

bool

htmlSummary

rtype:

str

isEnabled

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

isSignalConnected

isVisibleInZRange

param range:

layerLooksLikeDem

Returns True if a raster layer looks like a DEM.

mode

Returns the elevation mode.

profileFillSymbol

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

profileLineSymbol

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

profileSymbology

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

readCommonProperties

Reads common class properties from a DOM element previously written by writeXml().

readXml

param element:

receivers

sender

senderSignalIndex

setBandNumber

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

setElevationLimit

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.

setEnabled

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

setFixedRange

Sets the fixed elevation range for the raster.

setFixedRangePerBand

Sets the fixed elevation range for each band.

setMode

Sets the elevation mode.

setProfileFillSymbol

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

setProfileLineSymbol

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

setProfileSymbology

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

showByDefaultInElevationProfilePlots

rtype:

bool

timerEvent

writeCommonProperties

Writes common class properties to a DOM element, to be used later with readXml().

writeXml

param element:

bandNumber(self) int

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

calculateZRange(self, layer: QgsMapLayer) QgsDoubleRange
Parameters:

layer (QgsMapLayer) –

Return type:

QgsDoubleRange

childEvent(self, QChildEvent)
clone(self) QgsRasterLayerElevationProperties
Return type:

QgsRasterLayerElevationProperties

connectNotify(self, QMetaMethod)
copyCommonProperties(self, other: QgsMapLayerElevationProperties)

Copies common properties from another object.

New in version 3.26.

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
elevationLimit(self) float

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.

New in version 3.32.

Return type:

float

elevationRangeForPixelValue(self, band: int, pixelValue: float) QgsDoubleRange

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.

New in version 3.38.

Parameters:
  • band (int) –

  • pixelValue (float) –

Return type:

QgsDoubleRange

fixedRange(self) QgsDoubleRange

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()

New 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.

New in version 3.38.

Return type:

Dict[int, QgsDoubleRange]

hasElevation(self) bool
Return type:

bool

htmlSummary(self) str
Return type:

str

isEnabled(self) bool

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

See also

setEnabled()

Return type:

bool

isSignalConnected(self, QMetaMethod) bool
isVisibleInZRange(self, range: QgsDoubleRange) bool
Parameters:

range (QgsDoubleRange) –

Return type:

bool

layerLooksLikeDem(layer: QgsRasterLayer) bool

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

New in version 3.32.

Parameters:

layer (QgsRasterLayer) –

Return type:

bool

mode(self) Qgis.RasterElevationMode

Returns the elevation mode.

See also

setMode()

New in version 3.38.

Return type:

Qgis.RasterElevationMode

profileFillSymbol(self) QgsFillSymbol

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

Return type:

QgsFillSymbol

profileLineSymbol(self) QgsLineSymbol

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

Return type:

QgsLineSymbol

profileSymbology(self) Qgis.ProfileSurfaceSymbology

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

Return type:

Qgis.ProfileSurfaceSymbology

readCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)

Reads common class properties from a DOM element previously written by writeXml().

New in version 3.26.

readXml(self, element: QDomElement, context: QgsReadWriteContext) bool
Parameters:
Return type:

bool

receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
setBandNumber(self, band: int)

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)

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()

New in version 3.32.

Parameters:

limit (float) –

setEnabled(self, enabled: bool)

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)

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()

New in version 3.38.

Parameters:

range (QgsDoubleRange) –

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

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.

New in version 3.38.

Parameters:

ranges (Dict[int) –

setMode(self, mode: Qgis.RasterElevationMode)

Sets the elevation mode.

See also

mode()

New in version 3.38.

Parameters:

mode (Qgis.RasterElevationMode) –

setProfileFillSymbol(self, symbol: QgsFillSymbol)

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

Ownership of symbol is transferred to the plot.

Parameters:

symbol (QgsFillSymbol) –

setProfileLineSymbol(self, symbol: QgsLineSymbol)

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

Ownership of symbol is transferred to the plot.

Parameters:

symbol (QgsLineSymbol) –

setProfileSymbology(self, symbology: Qgis.ProfileSurfaceSymbology)

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

Parameters:

symbology (Qgis.ProfileSurfaceSymbology) –

showByDefaultInElevationProfilePlots(self) bool
Return type:

bool

timerEvent(self, QTimerEvent)
writeCommonProperties(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext)

Writes common class properties to a DOM element, to be used later with readXml().

New in version 3.26.

writeXml(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) QDomElement
Parameters:
Return type:

QDomElement