Class: QgsKernelDensityEstimation¶
- class qgis.analysis.QgsKernelDensityEstimation¶
Bases:
sip.wrapper
Performs Kernel Density Estimation (“heatmap”) calculations on a vector layer.
New in version 3.0.
QgsKernelDensityEstimation(parameters: QgsKernelDensityEstimation.Parameters, outputFile: str, outputFormat: str) Constructor for
QgsKernelDensityEstimation
. Requires a Parameters object specifying the options to use to generate the surface. The output path and file format are also required.Methods
Adds a single feature to the KDE surface.
Finalises the output file.
Prepares the output file for writing and setups up the surface calculation.
Runs the KDE calculation across the whole layer at once.
Attributes
- DriverError = 1¶
- FileCreationError = 3¶
- InvalidParameters = 2¶
- KernelEpanechnikov = 4¶
- KernelQuartic = 0¶
- class KernelShape¶
Bases:
int
- KernelTriangular = 1¶
- KernelTriweight = 3¶
- KernelUniform = 2¶
- OutputRaw = 0¶
- OutputScaled = 1¶
- class OutputValues¶
Bases:
int
- class Parameters¶
- class Parameters(QgsKernelDensityEstimation.Parameters)
Bases:
sip.wrapper
- decayRatio¶
- outputValues¶
- pixelSize¶
- radius¶
- radiusField¶
- shape¶
- source¶
- weightField¶
- RasterIoError = 4¶
- class Result¶
Bases:
int
- Success = 0¶
- addFeature(self, feature: QgsFeature) QgsKernelDensityEstimation.Result ¶
Adds a single feature to the KDE surface.
prepare()
must be called before adding features.See also
See also
- Parameters
feature (QgsFeature) –
- Return type
- finalise(self) QgsKernelDensityEstimation.Result ¶
Finalises the output file. Must be called after adding all features via
addFeature()
.See also
See also
- Return type
- prepare(self) QgsKernelDensityEstimation.Result ¶
Prepares the output file for writing and setups up the surface calculation. This must be called before adding features via
addFeature()
.See also
See also
- Return type
- run(self) QgsKernelDensityEstimation.Result ¶
Runs the KDE calculation across the whole layer at once. Either call this method, or manually call
run()
,addFeature()
andfinalise()
separately.- Return type