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.

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]

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.

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])

setSources(self, sources: Iterable[QgsAbstractProfileSource])[source]

Sets the list of sources participating in the elevation profile.

See also

sources()

Parameters:

sources (Iterable[QgsAbstractProfileSource])

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)

sources(self) List[QgsAbstractProfileSource]

Returns the list of sources participating in the elevation profile.

It includes both layer profile sources and custom sources from the profile source registry.

See also

setSources()

Return type:

List[QgsAbstractProfileSource]

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