Class: QgsHeatmapRenderer

A renderer which draws points as a live heatmap.

Class Hierarchy

Inheritance diagram of qgis.core.QgsHeatmapRenderer

Base classes

QgsFeatureRenderer

Abstract base class for all 2D vector feature renderers.

class qgis.core.QgsHeatmapRenderer[source]

Bases: QgsFeatureRenderer

colorRamp(self) QgsColorRamp | None[source]

Returns the color ramp used for shading the heatmap.

Return type:

Optional[QgsColorRamp]

Returns:

color ramp for heatmap

See also

setColorRamp()

static convertFromRenderer(renderer: QgsFeatureRenderer | None) QgsHeatmapRenderer | None[source]
Parameters:

renderer (Optional[QgsFeatureRenderer])

Return type:

Optional[QgsHeatmapRenderer]

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

Creates a new heatmap renderer instance from XML

Parameters:
Return type:

Optional[QgsFeatureRenderer]

legendSettings(self) QgsColorRampLegendNodeSettings

Returns the color ramp legend settings.

Added in version 3.38.

Return type:

QgsColorRampLegendNodeSettings

maximumValue(self) float[source]

Returns the maximum value used for shading the heatmap.

Return type:

float

Returns:

maximum value for heatmap shading. If 0, then maximum value will be automatically calculated.

radius(self) float[source]

Returns the radius for the heatmap

Return type:

float

Returns:

heatmap radius

See also

setRadius()

See also

radiusUnit()

radiusMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale used for the heatmap’s radius

Return type:

QgsMapUnitScale

Returns:

map unit scale for heatmap’s radius

See also

radius()

See also

radiusUnit()

radiusUnit(self) Qgis.RenderUnit[source]

Returns the units used for the heatmap’s radius

Return type:

Qgis.RenderUnit

Returns:

units for heatmap radius

See also

radius()

See also

setRadiusUnit()

renderQuality(self) float[source]

Returns the render quality used for drawing the heatmap.

Return type:

float

Returns:

render quality. A value of 1 indicates maximum quality, and increasing the value will result in faster drawing but lower quality rendering.

setColorRamp(self, ramp: QgsColorRamp | None)[source]

Sets the color ramp to use for shading the heatmap.

Parameters:

ramp (Optional[QgsColorRamp]) – color ramp for heatmap. Ownership of ramp is transferred to the renderer.

See also

colorRamp()

setLegendSettings(self, settings: QgsColorRampLegendNodeSettings)[source]

Sets the color ramp legend settings.

See also

legendSettings()

Added in version 3.38.

Parameters:

settings (QgsColorRampLegendNodeSettings)

setMaximumValue(self, value: float)[source]

Sets the maximum value used for shading the heatmap.

Parameters:

value (float) – maximum value for heatmap shading. Set to 0 for automatic calculation of maximum value.

See also

maximumValue()

setRadius(self, radius: float)[source]

Sets the radius for the heatmap

Parameters:

radius (float) – heatmap radius

See also

radius()

See also

setRadiusUnit()

setRadiusMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale used for the heatmap’s radius

Parameters:

scale (QgsMapUnitScale) – map unit scale for heatmap’s radius

See also

setRadius()

See also

setRadiusUnit()

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

Sets the units used for the heatmap’s radius

Parameters:

unit (Qgis.RenderUnit) – units for heatmap radius

See also

radiusUnit()

See also

setRadius()

setRenderQuality(self, quality: int)[source]

Sets the render quality used for drawing the heatmap.

Parameters:

quality (int) – render quality. A value of 1 indicates maximum quality, and increasing the value will result in faster drawing but lower quality rendering.

See also

renderQuality()

setWeightExpression(self, expression: str | None)[source]

Sets the expression used for weighting points when generating the heatmap.

Parameters:

expression (Optional[str]) – point weight expression. If set to empty, all points are equally weighted.

weightExpression(self) str[source]

Returns the expression used for weighting points when generating the heatmap.

Return type:

str

Returns:

point weight expression. If empty, all points are equally weighted.