Class: QgsLabelThinningSettings

class qgis.core.QgsLabelThinningSettings

Bases: sip.wrapper

Contains settings related to how the label engine removes candidate label positions and reduces the number of displayed labels.

New in version 3.12:

Methods

limitNumberOfLabelsEnabled

Returns True if the number of labels drawn for the layer should be limited.

maximumNumberLabels

Returns the maximum number of labels which should be drawn for this layer.

minimumFeatureSize

Returns the minimum feature size (in millimeters) for a feature to be labelled.

setLimitNumberLabelsEnabled

Sets whether the the number of labels drawn for the layer should be limited.

setMaximumNumberLabels

Sets the maximum number of labels which should be drawn for this layer.

setMinimumFeatureSize

Sets the minimum feature size (in millimeters) for a feature to be labelled.

updateDataDefinedProperties

Updates the thinning settings to respect any data defined properties set within the specified properties collection.

limitNumberOfLabelsEnabled(self) bool

Returns True if the number of labels drawn for the layer should be limited.

Return type

bool

maximumNumberLabels(self) int

Returns the maximum number of labels which should be drawn for this layer. This only has an effect if limitNumberOfLabelsEnabled() is True.

Return type

int

minimumFeatureSize(self) float

Returns the minimum feature size (in millimeters) for a feature to be labelled.

Return type

float

setLimitNumberLabelsEnabled(self, enabled: bool)

Sets whether the the number of labels drawn for the layer should be limited.

Parameters

enabled (bool) –

setMaximumNumberLabels(self, number: int)

Sets the maximum number of labels which should be drawn for this layer. This only has an effect if limitNumberOfLabelsEnabled() is True.

Parameters

number (int) –

setMinimumFeatureSize(self, size: float)

Sets the minimum feature size (in millimeters) for a feature to be labelled.

Parameters

size (float) –

updateDataDefinedProperties(self, properties: QgsPropertyCollection, context: QgsExpressionContext)

Updates the thinning settings to respect any data defined properties set within the specified properties collection.

Parameters