Class: QgsPointDistanceRenderer

An abstract base class for distance based point renderers (e.g., clusterer and displacement renderers).

QgsPointDistanceRenderer handles calculation of point clusters using a distance based threshold. Subclasses must implement drawGroup() to handle the rendering of individual point clusters in the desired style.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsFeatureRenderer.clone(), drawGroup()

Class Hierarchy

Inheritance diagram of qgis.core.QgsPointDistanceRenderer

Base classes

QgsFeatureRenderer

Abstract base class for all 2D vector feature renderers.

Subclasses

QgsPointClusterRenderer

A renderer that automatically clusters points with the same geographic position.

QgsPointDisplacementRenderer

A renderer that automatically displaces points with the same geographic location.

Methods

labelAttributeName

Returns the attribute name used for labeling points, or an empty string if no labeling will be done by the renderer.

labelColor

Returns the color used for for labeling points.

labelFont

Returns the font used for labeling points.

minimumLabelScale

Returns the minimum map scale (i.e. most "zoomed out") at which points should be labeled by the renderer.

setLabelAttributeName

Sets the attribute name for labeling points.

setLabelColor

Sets the color to use for for labeling points.

setLabelFont

Sets the font used for labeling points.

setMinimumLabelScale

Sets the minimum map scale (i.e. most "zoomed out") at which points should be labeled by the renderer.

setTolerance

Sets the tolerance distance for grouping points.

setToleranceMapUnitScale

Sets the map unit scale object for the distance tolerance.

setToleranceUnit

Sets the units for the tolerance distance.

tolerance

Returns the tolerance distance for grouping points.

toleranceMapUnitScale

Returns the map unit scale object for the distance tolerance.

toleranceUnit

Returns the units for the tolerance distance.

class qgis.core.QgsPointDistanceRenderer[source]

Bases: QgsFeatureRenderer

__init__(rendererName: str | None, labelAttributeName: str | None = '')

Constructor for QgsPointDistanceRenderer.

Parameters:
  • rendererName (Optional[str]) – name of renderer for registry

  • labelAttributeName (Optional[str] = '') – optional attribute for labeling points

class GroupedFeature

Bases: object

Contains properties for a feature within a clustered group.

feature: QgsFeature

Feature

isSelected: bool

True if feature is selected and should be rendered in a selected state

label: str

Optional label text

symbol(self) QgsMarkerSymbol | None

Base symbol for rendering feature

Return type:

Optional[QgsMarkerSymbol]

labelAttributeName(self) str[source]

Returns the attribute name used for labeling points, or an empty string if no labeling will be done by the renderer.

See also

labelFont()

See also

labelColor()

Return type:

str

labelColor(self) QColor[source]

Returns the color used for for labeling points.

See also

setLabelColor()

See also

labelFont()

Return type:

QColor

labelFont(self) QFont[source]

Returns the font used for labeling points.

See also

setLabelFont()

See also

labelColor()

Return type:

QFont

minimumLabelScale(self) float[source]

Returns the minimum map scale (i.e. most “zoomed out”) at which points should be labeled by the renderer. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

Return type:

float

setLabelAttributeName(self, name: str | None)[source]

Sets the attribute name for labeling points.

Parameters:

name (Optional[str]) – attribute name, or empty string to avoid labeling features by the renderer

See also

setLabelFont()

See also

setLabelColor()

setLabelColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the color to use for for labeling points.

Parameters:

color (Union[QColor, Qt.GlobalColor]) – label color

See also

labelColor()

See also

setLabelFont()

setLabelFont(self, font: QFont)[source]

Sets the font used for labeling points.

Parameters:

font (QFont) – label font

See also

labelFont()

See also

setLabelColor()

setMinimumLabelScale(self, scale: float)[source]

Sets the minimum map scale (i.e. most “zoomed out”) at which points should be labeled by the renderer. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

Parameters:

scale (float)

setTolerance(self, distance: float)[source]

Sets the tolerance distance for grouping points. Units are specified using setToleranceUnit().

Parameters:

distance (float) – tolerance distance

See also

tolerance()

setToleranceMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale object for the distance tolerance. This is only used if the toleranceUnit() is set to QgsUnitTypes.RenderMapUnits.

Parameters:

scale (QgsMapUnitScale) – scale for distance tolerance

setToleranceUnit(self, unit: Qgis.RenderUnit)[source]

Sets the units for the tolerance distance.

Parameters:

unit (Qgis.RenderUnit) – tolerance distance units

See also

setTolerance()

See also

toleranceUnit()

tolerance(self) float[source]

Returns the tolerance distance for grouping points. Units are retrieved using toleranceUnit().

See also

setTolerance()

See also

toleranceUnit()

Return type:

float

toleranceMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale object for the distance tolerance. This is only used if the toleranceUnit() is set to QgsUnitTypes.RenderMapUnits.

See also

toleranceUnit()

Return type:

QgsMapUnitScale

toleranceUnit(self) Qgis.RenderUnit[source]

Returns the units for the tolerance distance.

See also

tolerance()

Return type:

Qgis.RenderUnit