Class: QgsInterpolator

Interface class for interpolations.

Interpolators take the vertices of a vector layer as base data. The z-Value can be an attribute or the z-coordinates in case of 3D types.

Class Hierarchy

Inheritance diagram of qgis.analysis.QgsInterpolator

Subclasses

QgsIDWInterpolator

Inverse distance weight interpolator.

QgsTinInterpolator

Interpolation in a triangular irregular network

Methods

cacheBaseData

Caches the vertex and value data from the provider.

interpolatePoint

Calculates interpolation value for map coordinates x, y

Attributes

Canceled

FeatureGeometryError

InvalidSource

SourceBreakLines

SourcePoints

SourceStructureLines

Success

ValueAttribute

ValueM

ValueZ

class qgis.analysis.QgsInterpolator[source]

Bases: object

Canceled = 1
FeatureGeometryError = 3
InvalidSource = 2
class LayerData

Bases: object

A source together with the information about interpolation attribute / z-coordinate interpolation and the type (point, structure line, breakline)

interpolationAttribute

Index of feature attribute to use for interpolation

source

Feature source

sourceType

Source type

transformContext

Coordinate transform context.

Added in version 3.10.1.

valueSource

Source for feature values to interpolate

class Result

Bases: int

SourceBreakLines = 2
SourcePoints = 0
SourceStructureLines = 1
class SourceType

Bases: int

Success = 0
ValueAttribute = 0
ValueM = 2
class ValueSource

Bases: int

ValueZ = 1
cacheBaseData(self, feedback: QgsFeedback | None = None) QgsInterpolator.Result[source]

Caches the vertex and value data from the provider. All the vertex data will be held in virtual memory.

An optional feedback argument may be specified to allow cancellation and progress reports from the cache operation.

Return type:

QgsInterpolator.Result

Returns:

Success in case of success

Parameters:

feedback (Optional[QgsFeedback] = None)

interpolatePoint(self, x: float, y: float, feedback: QgsFeedback | None = None)[source]

Calculates interpolation value for map coordinates x, y

Parameters:
  • x (float) – x-coordinate (in map units)

  • y (float) – y-coordinate (in map units)

  • feedback (Optional[QgsFeedback] = None) -> (int) – optional feedback object for progress and cancellation support

Returns:

  • 0 in case of success

  • result: interpolation result