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.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: interpolatePoint()
Class Hierarchy¶
Subclasses¶
Inverse distance weight interpolator. |
|
Interpolation in a triangular irregular network. |
Enums
Result of an interpolation operation |
|
Describes the type of input data |
|
Source for interpolated values from features |
Abstract Methods
Calculates interpolation value for map coordinates x, y |
Methods
Caches the vertex and value data from the provider. |
- class qgis.analysis.QgsInterpolator[source]¶
Bases:
object
- class LayerData¶
Bases:
object
A source together with the information about interpolation attribute / z-coordinate interpolation and the type (point, structure line, breakline)
- interpolationAttribute: int¶
Index of feature attribute to use for interpolation
- source: QgsFeatureSource¶
Feature source
- sourceType: QgsInterpolator.SourceType¶
Source type
- transformContext: QgsCoordinateTransformContext¶
Coordinate transform context.
Added in version 3.10.1.
- valueSource: QgsInterpolator.ValueSource¶
Source for feature values to interpolate
- class Result(*values)¶
Bases:
IntEnum
Result of an interpolation operation
Success
: Operation was successfulCanceled
: Operation was manually canceledInvalidSource
: Operation failed due to invalid sourceFeatureGeometryError
: Operation failed due to invalid feature geometry
- Canceled = 1¶
- FeatureGeometryError = 3¶
- InvalidSource = 2¶
- Success = 0¶
- class SourceType(*values)¶
Bases:
IntEnum
Describes the type of input data
Points
: Point sourceAvailable as
QgsInterpolator.SourcePoints
in older QGIS releases.StructureLines
: Structure linesAvailable as
QgsInterpolator.SourceStructureLines
in older QGIS releases.BreakLines
: Break linesAvailable as
QgsInterpolator.SourceBreakLines
in older QGIS releases.
- class ValueSource(*values)¶
Bases:
IntEnum
Source for interpolated values from features
Attribute
: Take value from feature’s attributeAvailable as
QgsInterpolator.ValueAttribute
in older QGIS releases.Z
: Use feature’s geometry Z values for interpolationAvailable as
QgsInterpolator.ValueZ
in older QGIS releases.M
: Use feature’s geometry M values for interpolationAvailable as
QgsInterpolator.ValueM
in older QGIS releases.
- 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:
- Returns:
Success in case of success
- Parameters:
feedback (Optional[QgsFeedback] = None)
- abstract 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