QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 class  KernelShape : int {
  Quartic = 0 , Triangular , Uniform , Triweight ,
  Epanechnikov
}
 Kernel shape type. More...
enum class  OutputValues : int { Raw = 0 , Scaled }
 Output values type. More...
enum class  Result : int {
  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 39 of file qgskde.h.

Member Enumeration Documentation

◆ KernelShape

enum class QgsKernelDensityEstimation::KernelShape : int
strong

Kernel shape type.

Enumerator
Quartic 

Quartic kernel.

Triangular 

Triangular kernel.

Uniform 

Uniform (flat) kernel.

Triweight 

Triweight kernel.

Epanechnikov 

Epanechnikov kernel.

Definition at line 43 of file qgskde.h.

◆ OutputValues

Output values type.

Enumerator
Raw 

Output the raw KDE values.

Scaled 

Output mathematically correct scaled values.

Definition at line 53 of file qgskde.h.

◆ Result

enum class QgsKernelDensityEstimation::Result : int
strong

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 60 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 24 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 108 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 207 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 70 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 45 of file qgskde.cpp.


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