Class: QgsMapLayerElevationProperties

class qgis.core.QgsMapLayerElevationProperties

Bases: PyQt5.QtCore.QObject

Base class for storage of map layer elevation properties.

QgsMapLayerElevationProperties exposes user-configurable settings for controlling how an individual QgsMapLayer behaves with relation to z values or elevations.

Added in version 3.18.

QgsMapLayerElevationProperties(parent: Optional[QObject]) Constructor for QgsMapLayerElevationProperties, with the specified parent object.

Enums

Property

Bases: enum.IntEnum

Methods

calculateZRange

Attempts to calculate the overall elevation or z range for the specified layer, using the settings defined by this elevation properties object.

childEvent

clone

Creates a clone of the properties.

connectNotify

copyCommonProperties

Copies common properties from another object.

customEvent

dataDefinedProperties

Returns a reference to the object's property collection, used for data defined overrides.

disconnectNotify

flags

Returns flags associated to the elevation properties.

hasElevation

Returns True if the layer has an elevation or z component.

htmlSummary

Returns a HTML formatted summary of the properties.

isSignalConnected

isVisibleInZRange

Returns True if the layer should be visible and rendered for the specified z range.

propertyDefinitions

Returns the definitions for data defined properties available for use in elevation properties.

readCommonProperties

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

readXml

Reads the elevation properties from a DOM element previously written by writeXml().

receivers

sender

senderSignalIndex

setDataDefinedProperties

Sets the object's property collection, used for data defined overrides.

setDefaultsFromLayer

Sets default properties based on sensible choices for the given map layer.

setZOffset

Sets the z offset, which is a fixed offset amount which will be added to z values from the layer.

setZScale

Sets the z scale, which is a scaling factor which will be applied to z values from the layer.

showByDefaultInElevationProfilePlots

Returns True if the layer should be visible by default in newly created elevation profile plots.

significantZValues

Returns a list of significant elevation/z-values for the specified layer, using the settings defined by this elevation properties object.

timerEvent

writeCommonProperties

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

writeXml

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

zOffset

Returns the z offset, which is a fixed offset amount which should be added to z values from the layer.

zScale

Returns the z scale, which is a scaling factor which should be applied to z values from the layer.

Signals

changed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

profileGenerationPropertyChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

profileRenderingPropertyChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

zOffsetChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

zScaleChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

Attributes

FlagDontInvalidateCachedRendersWhenRangeChanges

class Flag

Bases: int

FlagDontInvalidateCachedRendersWhenRangeChanges = 1
class Flags
class Flags(f: QgsMapLayerElevationProperties.Flags | QgsMapLayerElevationProperties.Flag)
class Flags(a0: QgsMapLayerElevationProperties.Flags)

Bases: sip.wrapper

class Property(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.IntEnum

Data definable properties.

Added in version 3.26.

  • ZOffset:

  • ExtrusionHeight: Extrusion height

  • RasterPerBandLowerElevation: Lower elevation for each raster band (since QGIS 3.38)

  • RasterPerBandUpperElevation: Upper elevation for each raster band (since QGIS 3.38)

calculateZRange(self, layer: QgsMapLayer | None) QgsDoubleRange

Attempts to calculate the overall elevation or z range for the specified layer, using the settings defined by this elevation properties object.

May return an infinite range if the extent could not be calculated.

Parameters:

layer (Optional[QgsMapLayer])

Return type:

QgsDoubleRange

changed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

childEvent(self, a0: QChildEvent | None)
clone(self) QgsMapLayerElevationProperties | None

Creates a clone of the properties.

Added in version 3.26.

Return type:

Optional[QgsMapLayerElevationProperties]

connectNotify(self, signal: QMetaMethod)
copyCommonProperties(self, other: QgsMapLayerElevationProperties | None)

Copies common properties from another object.

Added in version 3.26.

Parameters:

other (Optional[QgsMapLayerElevationProperties])

customEvent(self, a0: QEvent | None)
dataDefinedProperties(self) QgsPropertyCollection

Returns a reference to the object’s property collection, used for data defined overrides.

Added in version 3.26.

Return type:

QgsPropertyCollection

disconnectNotify(self, signal: QMetaMethod)
flags(self) QgsMapLayerElevationProperties.Flags

Returns flags associated to the elevation properties.

Return type:

QgsMapLayerElevationProperties.Flags

hasElevation(self) bool

Returns True if the layer has an elevation or z component.

Return type:

bool

htmlSummary(self) str

Returns a HTML formatted summary of the properties.

Added in version 3.26.

Return type:

str

isSignalConnected(self, signal: QMetaMethod) bool
isVisibleInZRange(self, range: QgsDoubleRange, layer: QgsMapLayer | None = None) bool

Returns True if the layer should be visible and rendered for the specified z range.

Since QGIS 3.38 the layer argument can be used to specify the target layer.

Parameters:
Return type:

bool

profileGenerationPropertyChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

profileRenderingPropertyChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

propertyDefinitions() Dict[int, QgsPropertyDefinition]

Returns the definitions for data defined properties available for use in elevation properties.

Added in version 3.26.

Return type:

Dict[int, QgsPropertyDefinition]

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

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

Added in version 3.26.

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

Reads the elevation properties from a DOM element previously written by writeXml().

See also

writeXml()

Parameters:
Return type:

bool

receivers(self, signal: PYQT_SIGNAL) int
sender(self) QObject | None
senderSignalIndex(self) int
setDataDefinedProperties(self, collection: QgsPropertyCollection)

Sets the object’s property collection, used for data defined overrides.

Any existing properties will be discarded.

See also

Property

Added in version 3.26.

Parameters:

collection (QgsPropertyCollection)

setDefaultsFromLayer(self, layer: QgsMapLayer | None)

Sets default properties based on sensible choices for the given map layer.

Added in version 3.26.

Parameters:

layer (Optional[QgsMapLayer])

setZOffset(self, offset: float)

Sets the z offset, which is a fixed offset amount which will be added to z values from the layer.

Note

Any scaling specified via zScale() is applied before any offset value specified via zOffset()

See also

zOffset()

Parameters:

offset (float)

setZScale(self, scale: float)

Sets the z scale, which is a scaling factor which will be applied to z values from the layer.

This can be used to correct or manually adjust for incorrect elevation values in a layer, such as conversion of elevation values in feet to meters.

Note

Any scaling specified via zScale() is applied before any offset value specified via zOffset()

See also

zScale()

Parameters:

scale (float)

showByDefaultInElevationProfilePlots(self) bool

Returns True if the layer should be visible by default in newly created elevation profile plots.

Subclasses should override this with logic which determines whether the layer is likely desirable to be initially checked in these plots.

Added in version 3.26.

Return type:

bool

significantZValues(self, layer: QgsMapLayer | None) List[float]

Returns a list of significant elevation/z-values for the specified layer, using the settings defined by this elevation properties object.

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

Added in version 3.38.

Parameters:

layer (Optional[QgsMapLayer])

Return type:

List[float]

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

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

Added in version 3.26.

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

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

See also

readXml()

Parameters:
Return type:

QDomElement

zOffset(self) float

Returns the z offset, which is a fixed offset amount which should be added to z values from the layer.

Note

Any scaling specified via zScale() is applied before any offset value specified via zOffset()

See also

setZOffset()

Return type:

float

zOffsetChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

zScale(self) float

Returns the z scale, which is a scaling factor which should be applied to z values from the layer.

This can be used to correct or manually adjust for incorrect elevation values in a layer, such as conversion of elevation values in feet to meters.

Note

Any scaling specified via zScale() is applied before any offset value specified via zOffset()

See also

setZScale()

Return type:

float

zScaleChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL