Class: QgsLayoutItemElevationProfile

A layout item subclass for elevation profile plots.

Added in version 3.30.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutItemElevationProfile

Base classes

QgsLayoutItem

Base class for graphical items within a QgsLayout.

QgsLayoutObject

A base class for objects which belong to a layout.

QObject

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

QGraphicsRectItem

QAbstractGraphicsShapeItem

QGraphicsItem

QgsLayoutUndoObjectInterface

Interface for layout objects which support undo/redo commands.

Methods

atlasDriven

Returns whether the profile curve is set to follow the current atlas feature.

crs

Returns the desired Coordinate Reference System for the profile.

distanceUnit

Returns the units for the distance axis.

layers

Returns the list of map layers participating in the elevation profile.

plot

Returns a reference to the elevation plot object, which can be used to set plot appearance and properties.

profileCurve

Returns the cross section profile curve, which represents the line along which the profile should be generated.

profileRequest

Returns the profile request used to generate the elevation profile.

setAtlasDriven

Sets whether the profile curve will follow the current atlas feature.

setCrs

Sets the desired Coordinate Reference System (crs) for the profile.

setDistanceUnit

Sets the unit for the distance axis.

setLayers

Sets the list of map layers participating in the elevation profile.

setProfileCurve

Sets the cross section profile curve, which represents the line along which the profile should be generated.

setSubsectionsSymbol

Sets the symbol used to draw the subsections.

setTolerance

Sets the tolerance of the request (in crs() units).

subsectionsSymbol

Returns the symbol used to draw the subsections.

tolerance

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

Static Methods

create

Returns a new elevation profile item for the specified layout.

Signals

previewRefreshed

Emitted whenever the item's preview has been refreshed.

class qgis.core.QgsLayoutItemElevationProfile[source]

Bases: QgsLayoutItem

__init__(layout: QgsLayout | None)

Constructor for QgsLayoutItemElevationProfile, with the specified parent layout.

Parameters:

layout (Optional[QgsLayout])

atlasDriven(self) bool[source]

Returns whether the profile curve is set to follow the current atlas feature.

See also

setAtlasDriven()

Return type:

bool

static create(layout: QgsLayout | None) QgsLayoutItemElevationProfile | None[source]

Returns a new elevation profile item for the specified layout.

The caller takes responsibility for deleting the returned object.

Parameters:

layout (Optional[QgsLayout])

Return type:

Optional[QgsLayoutItemElevationProfile]

crs(self) QgsCoordinateReferenceSystem[source]

Returns the desired Coordinate Reference System for the profile.

This also represents the CRS associated with the profileCurve().

See also

setCrs()

Return type:

QgsCoordinateReferenceSystem

distanceUnit(self) Qgis.DistanceUnit[source]

Returns the units for the distance axis.

Added in version 3.32.

Return type:

Qgis.DistanceUnit

layers(self) List[QgsMapLayer]

Returns the list of map layers participating in the elevation profile.

See also

setLayers()

Return type:

List[QgsMapLayer]

plot(self) Qgs2DXyPlot | None[source]

Returns a reference to the elevation plot object, which can be used to set plot appearance and properties.

Return type:

Optional[Qgs2DXyPlot]

signal previewRefreshed[source]

Emitted whenever the item’s preview has been refreshed.

Added in version 3.34.

profileCurve(self) QgsCurve | None[source]

Returns the cross section profile curve, which represents the line along which the profile should be generated.

The coordinate reference system of the curve is retrieved via crs().

Return type:

Optional[QgsCurve]

profileRequest(self) QgsProfileRequest[source]

Returns the profile request used to generate the elevation profile.

Return type:

QgsProfileRequest

setAtlasDriven(self, enabled: bool)[source]

Sets whether the profile curve will follow the current atlas feature.

This requires an active layout atlas or report, using a line geometry type coverage layer.

See also

atlasDriven()

Parameters:

enabled (bool)

setCrs(self, crs: QgsCoordinateReferenceSystem)[source]

Sets the desired Coordinate Reference System (crs) for the profile.

This also represents the CRS associated with the profileCurve().

See also

crs()

Parameters:

crs (QgsCoordinateReferenceSystem)

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

Sets the unit for the distance axis.

See also

distanceUnit()

Added in version 3.32.

Parameters:

unit (Qgis.DistanceUnit)

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

Sets the list of map layers participating in the elevation profile.

See also

layers()

Parameters:

layers (Iterable[QgsMapLayer])

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

Sets the cross section profile curve, which represents the line along which the profile should be generated.

Ownership of curve is transferred to the item.

The coordinate reference system of the curve is set via setCrs().

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.

Added in version 3.44.

Parameters:

symbol (Optional[QgsLineSymbol])

setTolerance(self, tolerance: float)[source]

Sets the tolerance of the request (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. Other sources may completely ignore this tolerance if it is not appropriate for the particular source.

See also

tolerance()

Parameters:

tolerance (float)

subsectionsSymbol(self) QgsLineSymbol | None[source]

Returns the symbol used to draw the subsections.

Added in version 3.44.

Return type:

Optional[QgsLineSymbol]

tolerance(self) float[source]

Returns the tolerance of the request (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. Other sources may completely ignore this tolerance if it is not appropriate for the particular source.

See also

setTolerance()

Return type:

float