Class: QgsElevationProfile

Represents an elevation profile attached to a project.

Added in version 4.0.

Class Hierarchy

Inheritance diagram of qgis.core.QgsElevationProfile

Base classes

QObject

Methods

crs

Returns the crs associated with the profile's map coordinates.

distanceUnit

Returns the distance unit used by the profile.

icon

Returns the icon to use for the elevation profile.

layerTree

Returns the layer tree used by the profile.

lockAxisScales

Returns True if the distance and elevation scales are locked to each other.

name

Returns the profile's unique name.

profileCurve

Returns the profile curve.

readXml

Sets the profiles's state from a DOM element.

resolveReferences

After reading settings from XML, resolves references to any layers in a project that have been read as layer IDs.

setCrs

Sets the crs associated with the profile's map coordinates.

setDistanceUnit

Sets the distance unit used by the profile.

setLockAxisScales

Sets whether the distance and elevation scales are locked to each other.

setName

Sets the profile's unique name.

setProfileCurve

Sets the profile curve.

setSubsectionsSymbol

Sets the symbol used to draw the subsections.

setTolerance

Sets the profile tolerance (in crs() units).

setUseProjectLayerTree

Sets whether the profile should always use the project's layer tree

subsectionsSymbol

Returns the symbol used to draw the subsections.

tolerance

Returns the tolerance of the profile (in crs() units).

useProjectLayerTree

Returns True if the profile should always use the project's layer tree

writeXml

Returns the profiles's state encapsulated in a DOM element.

Signals

nameChanged

Emitted when the profile is renamed.

useProjectLayerTreeChanged

Emitted when the use project layer tree property is changed.

class qgis.core.QgsElevationProfile[source]

Bases: QObject

__init__(project: QgsProject | None)

Constructor for QgsElevationProfile.

Parameters:

project (Optional[QgsProject])

crs(self) QgsCoordinateReferenceSystem[source]

Returns the crs associated with the profile’s map coordinates.

See also

setCrs()

Return type:

QgsCoordinateReferenceSystem

distanceUnit(self) Qgis.DistanceUnit[source]

Returns the distance unit used by the profile.

Return type:

Qgis.DistanceUnit

icon(self) QIcon[source]

Returns the icon to use for the elevation profile.

Return type:

QIcon

layerTree(self) QgsLayerTree | None[source]

Returns the layer tree used by the profile.

Will be None if useProjectLayerTree() is True.

Return type:

Optional[QgsLayerTree]

lockAxisScales(self) bool[source]

Returns True if the distance and elevation scales are locked to each other.

Return type:

bool

name(self) str[source]

Returns the profile’s unique name.

See also

setName()

See also

nameChanged()

Return type:

str

signal nameChanged(newName: str)[source]

Emitted when the profile is renamed.

See also

name()

See also

setName()

Parameters:

newName (str)

profileCurve(self) QgsCurve | None[source]

Returns the profile curve.

The CRS associated with the curve is retrieved via crs().

Return type:

Optional[QgsCurve]

readXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool[source]

Sets the profiles’s state from a DOM element.

element is the DOM node corresponding to the profile.

See also

writeXml()

Parameters:
Return type:

bool

resolveReferences(self, project: QgsProject | None)[source]

After reading settings from XML, resolves references to any layers in a project that have been read as layer IDs.

See also

readXml()

Parameters:

project (Optional[QgsProject])

setCrs(self, crs: QgsCoordinateReferenceSystem)[source]

Sets the crs associated with the profile’s map coordinates.

See also

crs()

Parameters:

crs (QgsCoordinateReferenceSystem)

setDistanceUnit(self, unit: Qgis.DistanceUnit)[source]

Sets the distance unit used by the profile.

See also

distanceUnit()

Parameters:

unit (Qgis.DistanceUnit)

setLockAxisScales(self, lock: bool)[source]

Sets whether the distance and elevation scales are locked to each other.

See also

lockAxisScales()

Parameters:

lock (bool)

setName(self, name: str | None)[source]

Sets the profile’s unique name.

See also

name()

See also

nameChanged()

Parameters:

name (Optional[str])

setProfileCurve(self, curve: QgsCurve | None)[source]

Sets the profile curve.

The CRS associated with curve is set via setCrs().

Ownership is transferred to the profile.

See also

profileCurve()

Parameters:

curve (Optional[QgsCurve])

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

Sets the symbol used to draw the subsections.

If symbol is None, the subsections are not drawn. Ownership of symbol is transferred.

Parameters:

symbol (Optional[QgsLineSymbol])

setTolerance(self, tolerance: float)[source]

Sets the profile tolerance (in crs() units).

This value determines how far from the profileCurve() is appropriate for inclusion of results. For instance, when a profile is generated for a point vector layer this tolerance distance will dictate how far from the actual profile curve a point can reside within to be included in the results.

See also

tolerance()

Parameters:

tolerance (float)

setUseProjectLayerTree(self, useProjectTree: bool)[source]

Sets whether the profile should always use the project’s layer tree

i.e. the profiles layer tree will be synchronized to the project and no reordering or re-grouping of layers is supported.

See also

layerTree()

Parameters:

useProjectTree (bool)

subsectionsSymbol(self) QgsLineSymbol | None[source]

Returns the symbol used to draw the subsections.

Return type:

Optional[QgsLineSymbol]

tolerance(self) float[source]

Returns the tolerance of the profile (in crs() units).

This value determines how far from the profileCurve() is appropriate for inclusion of results. For instance, when a profile is generated for a point vector layer this tolerance distance will dictate how far from the actual profile curve a point can reside within to be included in the results.

See also

setTolerance()

Return type:

float

useProjectLayerTree(self) bool[source]

Returns True if the profile should always use the project’s layer tree

i.e. the profiles layer tree will be synchronized to the project and no reordering or re-grouping of layers is supported.

See also

layerTree()

Return type:

bool

signal useProjectLayerTreeChanged(useProjectTree: bool)[source]

Emitted when the use project layer tree property is changed.

Parameters:

useProjectTree (bool)

writeXml(self, document: QDomDocument, context: QgsReadWriteContext) QDomElement[source]

Returns the profiles’s state encapsulated in a DOM element.

See also

readXml()

Parameters:
Return type:

QDomElement