Class: QgsRasterLayerSimpleLabeling

Basic implementation of the labeling interface for raster layers.

Added in version 3.42.

Class Hierarchy

Inheritance diagram of qgis.core.QgsRasterLayerSimpleLabeling

Base classes

QgsAbstractRasterLayerLabeling

Abstract base class for labeling settings for raster layers.

Methods

band

Returns the raster band to use for label values.

hasScaleBasedVisibility

Returns whether scale based visibility is enabled for the labels.

maximumScale

Returns the maximum map scale (i.e. most "zoomed in" scale) at which the labels will be visible.

minimumScale

Returns the minimum map scale (i.e. most "zoomed out" scale) at which the labels will be visible.

numericFormat

Returns the numeric format used for the labels.

placementSettings

Returns the label placement settings.

priority

Returns the priority of labels.

resampleMethod

Returns the resampling method used when the raster labels are being resampled over neighboring pixels.

resampleOver

Returns the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.

setBand

Sest the raster band to use for label values.

setMaximumScale

Sets the maximum map scale (i.e. most "zoomed in" scale) at which the labels will be visible.

setMinimumScale

Sets the minimum map scale (i.e. most "zoomed out" scale) at which the labels will be visible.

setNumericFormat

Sets the numeric format used for the labels.

setPlacementSettings

Sets the label placement settings.

setPriority

Sets the priority of labels.

setResampleMethod

Sets the resampling method to use when the raster labels are being resampled over neighboring pixels.

setResampleOver

Sets the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.

setScaleBasedVisibility

Sets whether scale based visibility is enabled for the labels.

setTextFormat

Sets the text format used for rendering the labels.

setThinningSettings

Sets the label thinning settings.

setZIndex

Sets the Z-Index of the labels.

textFormat

Returns the text format used for rendering the labels.

thinningSettings

Returns the label thinning settings.

zIndex

Returns the Z-Index of the labels.

Static Methods

create

Creates a QgsRasterLayerSimpleLabeling from a DOM element with saved configuration

class qgis.core.QgsRasterLayerSimpleLabeling[source]

Bases: QgsAbstractRasterLayerLabeling

band(self) int[source]

Returns the raster band to use for label values.

See also

setBand()

Return type:

int

static create(element: QDomElement, context: QgsReadWriteContext) QgsRasterLayerSimpleLabeling | None[source]

Creates a QgsRasterLayerSimpleLabeling from a DOM element with saved configuration

Parameters:
Return type:

Optional[QgsRasterLayerSimpleLabeling]

hasScaleBasedVisibility(self) bool[source]

Returns whether scale based visibility is enabled for the labels.

See also

minimumScale()

See also

maximumScale()

Return type:

bool

maximumScale(self) float[source]

Returns the maximum map scale (i.e. most “zoomed in” scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is True.

See also

minimumScale()

Return type:

float

minimumScale(self) float[source]

Returns the minimum map scale (i.e. most “zoomed out” scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no minimum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is True.

See also

maximumScale()

Return type:

float

numericFormat(self) QgsNumericFormat | None[source]

Returns the numeric format used for the labels.

Return type:

Optional[QgsNumericFormat]

placementSettings(self) QgsLabelPlacementSettings

Returns the label placement settings.

Return type:

QgsLabelPlacementSettings

priority(self) float[source]

Returns the priority of labels.

This is a value between 0 to 1, where 0 = highest priority and 1 = lowest priority.

The default is 0.5.

See also

setPriority()

Return type:

float

resampleMethod(self) Qgis.RasterResamplingMethod[source]

Returns the resampling method used when the raster labels are being resampled over neighboring pixels.

See also

resampleOver()

Return type:

Qgis.RasterResamplingMethod

resampleOver(self) int[source]

Returns the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.

See also

resampleMethod()

Return type:

int

setBand(self, band: int)[source]

Sest the raster band to use for label values.

See also

band()

Parameters:

band (int)

setMaximumScale(self, scale: float)[source]

Sets the maximum map scale (i.e. most “zoomed in” scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is True.

See also

maximumScale()

Parameters:

scale (float)

setMinimumScale(self, scale: float)[source]

Sets the minimum map scale (i.e. most “zoomed out” scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no minimum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is True.

See also

minimumScale()

Parameters:

scale (float)

setNumericFormat(self, format: QgsNumericFormat | None)[source]

Sets the numeric format used for the labels.

Ownership of format is transferred to the labeling.

See also

numericFormat()

Parameters:

format (Optional[QgsNumericFormat])

setPlacementSettings(self, settings: QgsLabelPlacementSettings)[source]

Sets the label placement settings.

Parameters:

settings (QgsLabelPlacementSettings)

setPriority(self, priority: float)[source]

Sets the priority of labels.

This is a value between 0 to 1, where 0 = highest priority and 1 = lowest priority.

See also

priority()

Parameters:

priority (float)

setResampleMethod(self, method: Qgis.RasterResamplingMethod)[source]

Sets the resampling method to use when the raster labels are being resampled over neighboring pixels.

See also

resampleMethod()

Parameters:

method (Qgis.RasterResamplingMethod)

setResampleOver(self, pixels: int)[source]

Sets the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.

See also

resampleOver()

Parameters:

pixels (int)

setScaleBasedVisibility(self, enabled: bool)[source]

Sets whether scale based visibility is enabled for the labels.

Parameters:

enabled (bool)

setTextFormat(self, format: QgsTextFormat)[source]

Sets the text format used for rendering the labels.

See also

textFormat()

Parameters:

format (QgsTextFormat)

setThinningSettings(self, settings: QgsLabelThinningSettings)[source]

Sets the label thinning settings.

Parameters:

settings (QgsLabelThinningSettings)

setZIndex(self, index: float)[source]

Sets the Z-Index of the labels.

Labels with a higher z-index are rendered on top of labels with a lower z-index.

See also

zIndex()

Parameters:

index (float)

textFormat(self) QgsTextFormat[source]

Returns the text format used for rendering the labels.

See also

setTextFormat()

Return type:

QgsTextFormat

thinningSettings(self) QgsLabelThinningSettings

Returns the label thinning settings.

Return type:

QgsLabelThinningSettings

zIndex(self) float[source]

Returns the Z-Index of the labels.

Labels with a higher z-index are rendered on top of labels with a lower z-index.

See also

setZIndex()

Return type:

float