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.

layers

Returns the list of layers included in 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.

setLayers

Sets the list of layers to include in 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).

subsectionsSymbol

Returns the symbol used to draw the subsections.

tolerance

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

writeXml

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

Signals

nameChanged

Emitted when the profile is renamed.

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

layers(self) List[QgsMapLayer]

Returns the list of layers included in the profile.

See also

setLayers()

Return type:

List[QgsMapLayer]

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)

setLayers(self, layers: Iterable[QgsMapLayer])[source]

Sets the list of layers to include in the profile.

See also

layers()

Parameters:

layers (Iterable[QgsMapLayer])

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)

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

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