QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
Classes | Public Types | Public Member Functions | List of all members
QgsKernelDensityEstimation Class Reference

Performs Kernel Density Estimation ("heatmap") calculations on a vector layer. More...

#include <qgskde.h>

Classes

struct  Parameters
 KDE parameters. More...
 

Public Types

enum  KernelShape {
  KernelQuartic = 0 , KernelTriangular , KernelUniform , KernelTriweight ,
  KernelEpanechnikov
}
 Kernel shape type. More...
 
enum  OutputValues { OutputRaw = 0 , OutputScaled }
 Output values type. More...
 
enum  Result {
  Success , DriverError , InvalidParameters , FileCreationError ,
  RasterIoError
}
 Result of operation. More...
 

Public Member Functions

 QgsKernelDensityEstimation (const Parameters &parameters, const QString &outputFile, const QString &outputFormat)
 Constructor for QgsKernelDensityEstimation. More...
 
 QgsKernelDensityEstimation (const QgsKernelDensityEstimation &other)=delete
 QgsKernelDensityEstimation cannot be copied. More...
 
Result addFeature (const QgsFeature &feature)
 Adds a single feature to the KDE surface. More...
 
Result finalise ()
 Finalises the output file. More...
 
QgsKernelDensityEstimationoperator= (const QgsKernelDensityEstimation &other)=delete
 QgsKernelDensityEstimation cannot be copied. More...
 
Result prepare ()
 Prepares the output file for writing and setups up the surface calculation. More...
 
Result run ()
 Runs the KDE calculation across the whole layer at once. More...
 

Detailed Description

Performs Kernel Density Estimation ("heatmap") calculations on a vector layer.

Since
QGIS 3.0

Definition at line 39 of file qgskde.h.

Member Enumeration Documentation

◆ KernelShape

Kernel shape type.

Enumerator
KernelQuartic 

Quartic kernel.

KernelTriangular 

Triangular kernel.

KernelUniform 

Uniform (flat) kernel.

KernelTriweight 

Triweight kernel.

KernelEpanechnikov 

Epanechnikov kernel.

Definition at line 44 of file qgskde.h.

◆ OutputValues

Output values type.

Enumerator
OutputRaw 

Output the raw KDE values.

OutputScaled 

Output mathematically correct scaled values.

Definition at line 54 of file qgskde.h.

◆ Result

Result of operation.

Enumerator
Success 

Operation completed successfully.

DriverError 

Could not open the driver for the specified format.

InvalidParameters 

Input parameters were not valid.

FileCreationError 

Error creating output file.

RasterIoError 

Error writing to raster.

Definition at line 61 of file qgskde.h.

Constructor & Destructor Documentation

◆ QgsKernelDensityEstimation() [1/2]

QgsKernelDensityEstimation::QgsKernelDensityEstimation ( const Parameters parameters,
const QString &  outputFile,
const QString &  outputFormat 
)

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.

Definition at line 23 of file qgskde.cpp.

◆ QgsKernelDensityEstimation() [2/2]

QgsKernelDensityEstimation::QgsKernelDensityEstimation ( const QgsKernelDensityEstimation other)
delete

QgsKernelDensityEstimation cannot be copied.

Member Function Documentation

◆ addFeature()

QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::addFeature ( const QgsFeature feature)

Adds a single feature to the KDE surface.

prepare() must be called before adding features.

See also
prepare()
finalise()

Definition at line 107 of file qgskde.cpp.

◆ finalise()

QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::finalise ( )

Finalises the output file.

Must be called after adding all features via addFeature().

See also
prepare()
addFeature()

Definition at line 208 of file qgskde.cpp.

◆ operator=()

QgsKernelDensityEstimation& QgsKernelDensityEstimation::operator= ( const QgsKernelDensityEstimation other)
delete

QgsKernelDensityEstimation cannot be copied.

◆ prepare()

QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::prepare ( )

Prepares the output file for writing and setups up the surface calculation.

This must be called before adding features via addFeature().

See also
addFeature()
finalise()

Definition at line 69 of file qgskde.cpp.

◆ run()

QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::run ( )

Runs the KDE calculation across the whole layer at once.

Either call this method, or manually call run(), addFeature() and finalise() separately.

Definition at line 44 of file qgskde.cpp.


The documentation for this class was generated from the following files: