Class: QgsElevationUtils

Contains utility methods for working with elevation from layers and projects.

Added in version 3.18.

Static Methods

calculateZRangeForProject

Calculates the elevation range for a project.

canEnableElevationForLayer

Returns True if elevation can be enabled for a map layer.

enableElevationForLayer

Automatically enables elevation for a map layer, using reasonable defaults.

significantZValuesForLayers

Returns a list of significant elevation/z-values for the specified layers.

significantZValuesForProject

Returns a list of significant elevation/z-values for the specified project, using the values from layers contained by the project.

class qgis.core.QgsElevationUtils[source]

Bases: object

static calculateZRangeForProject(project: QgsProject | None) QgsDoubleRange[source]

Calculates the elevation range for a project.

This method considers the elevation (or z) range available from layers contained within the project and returns the maximal combined elevation range of these layers.

Parameters:

project (Optional[QgsProject])

Return type:

QgsDoubleRange

static canEnableElevationForLayer(layer: QgsMapLayer | None) bool[source]

Returns True if elevation can be enabled for a map layer.

Added in version 3.32.

Parameters:

layer (Optional[QgsMapLayer])

Return type:

bool

static enableElevationForLayer(layer: QgsMapLayer | None) bool[source]

Automatically enables elevation for a map layer, using reasonable defaults.

Returns True if the elevation was enabled successfully.

Added in version 3.32.

Parameters:

layer (Optional[QgsMapLayer])

Return type:

bool

static significantZValuesForLayers(layers: Iterable[QgsMapLayer]) List[float]

Returns a list of significant elevation/z-values for the specified layers.

These values will be highlighted in elevation related widgets for the project.

Added in version 3.38.

Parameters:

layers (Iterable[QgsMapLayer])

Return type:

List[float]

static significantZValuesForProject(project: QgsProject | None) List[float]

Returns a list of significant elevation/z-values for the specified project, using the values from layers contained by the project.

These values will be highlighted in elevation related widgets for the project.

Added in version 3.38.

Parameters:

project (Optional[QgsProject])

Return type:

List[float]