QgsIDWInterpolator class

Inverse distance weight interpolator.

Base classes

class QgsInterpolator
Interface class for interpolations.

Constructors, destructors, conversion operators

QgsIDWInterpolator(const QList<QgsInterpolator::LayerData>& layerData)
Constructor for QgsIDWInterpolator, with the specified layerData sources.

Public functions

auto distanceCoefficient() const -> double
Returns the distance coefficient, the parameter that sets how the values are weighted with distance.
auto interpolatePoint(double x, double y, double& result, QgsFeedback* feedback = nullptr) -> int override
Calculates interpolation value for map coordinates x, y.
void setDistanceCoefficient(double coefficient)
Sets the distance coefficient, the parameter that sets how the values are weighted with distance.

Function documentation

double QgsIDWInterpolator::distanceCoefficient() const

Returns the distance coefficient, the parameter that sets how the values are weighted with distance.

Smaller values mean sharper peaks at the data points. The default is a coefficient of 2.

Point values are weighted by 1 / ( distance ^ coefficient ).

int QgsIDWInterpolator::interpolatePoint(double x, double y, double& result, QgsFeedback* feedback = nullptr) override

Calculates interpolation value for map coordinates x, y.

Parameters
x x-coordinate (in map units)
y y-coordinate (in map units)
result interpolation result
feedback optional feedback object for progress and cancelation support
Returns 0 in case of success

void QgsIDWInterpolator::setDistanceCoefficient(double coefficient)

Sets the distance coefficient, the parameter that sets how the values are weighted with distance.

Smaller values mean sharper peaks at the data points.

Point values are weighted by 1 / ( distance ^ coefficient ).