QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
 QgsKernelDensityEstimation (const QgsKernelDensityEstimation &other)=delete
 
Result addFeature (const QgsFeature &feature)
 Adds a single feature to the KDE surface.
 
Result finalise ()
 Finalises the output file.
 
QgsKernelDensityEstimationoperator= (const QgsKernelDensityEstimation &other)=delete
 
Result prepare ()
 Prepares the output file for writing and setups up the surface calculation.
 
Result run ()
 Runs the KDE calculation across the whole layer at once.
 

Detailed Description

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

Definition at line 38 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 42 of file qgskde.h.

◆ OutputValues

Output values type.

Enumerator
OutputRaw 

Output the raw KDE values.

OutputScaled 

Output mathematically correct scaled values.

Definition at line 52 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 59 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

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 206 of file qgskde.cpp.

◆ operator=()

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

◆ 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: