DK11 for Delphi | GisInterpolation.TGIS_InterpolationIDW | Classes | Constructors | Methods | Properties
Implementation of the Inverse Distance Weighting (IDW) interpolation method.
// Delphi type TGIS_InterpolationIDW = class( TGIS_VectorToGridAbstract ) end;
// C++ Builder class PASCALIMPLEMENTATION TGIS_InterpolationIDW : public TGIS_VectorToGridAbstract { };
→ TObject → TGIS_BaseObjectDisposable → TGIS_VectorToGridAbstract
Name | Visibility | Description | |
---|---|---|---|
Generate | public | Populates a pixel (grid) layer with values resulting from computations based on the set of sample points from the vector layer. _{ (Overrides TGIS_VectorToGridAbstract.Generate) } | |
Name | Visibility | Description | |
---|---|---|---|
Coordinate | public | Defines which coordinate is taken as interpolation value if the interpolation is not based on an attribute field; default is Z. _{ (Inherited from TGIS_VectorToGridAbstract)} | |
DefaultValue | public | If UseDefaultValue is true, then this value will be set for each grid cell for which the interpolated value cannot be computed. _{ (Inherited from TGIS_VectorToGridAbstract)} | |
Exponent | public | Exponent in the formula for weight calculation; default value is 2. _{} | |
Radius | public | Applies only to the windowed method (Windowed = True). _{} | |
UseDefaultValue | public | If true, then each grid cell for which the interpolated value cannot be computed will be set to DefaultValue. _{ (Inherited from TGIS_VectorToGridAbstract)} | |
Windowed | public | If True then the windowed version of the algorithm is used; true by default. _{} | |
The Inverse Distance Squared (IDW) interpolation method assumes that the influence of the data points on the interpolated point diminishes with distance, i.e., nearby points have greater weight than points that are further away.
There are two different scenarios for generating an IDW interpolated grid:
Coordinate
property to the desired optionGenerate
methodGenerate
methodCoordinate
property is neglected
The Exponent
property plays the role of a smoothening factor. For most cases, reasonable results are obtained for the exponent value between 2.0 (default) and 3.0. For big exponent values, the algorithm converges with the Voronoi diagram.
Use a windowed version of the algorithm (Windowed=True
) for large datasets (thousands of points and more). For up to a few hundred points, the non-windowed (full sample) algorithm is efficient enough and gives the best possible results. The Radius
property is the size of the window in map units.
var src : TGIS_LayerVector ; dst : TGIS_LayerPixel ; vtg : TGIS_InterpolationIDW ; ext : TGIS_Extent ; begin // get the source layer (GIS is TGIS_ViewerWnd) src := TGIS_LayerVector( GIS.Get( 'points' ) ) ; ext := src.Extent ; // create the destination layer (grid, 200x200 pixels) dst := TGIS_LayerPixel.Create ; dst.Build( True, lsrc.CS, ext, 200, 200 ) ; dst.Name := 'Heatmap' ; dst.Params.Pixel.GridShadow := False ; // create an instance of the IDW interpolation engine vtg := TGIS_InterpolationIDW.Create ; try // attach event to track the progress vtg.BusyEvent := doBusyEvent ; // set the exponent for weight calculation vtg.Exponent := 3.0 ; // initiate the grid generation process for the // POPULATION attribute field vtg.Import( lsrc, ext, 'POPULATION', ldst, ext ) ; finally vtg.Free ; end ; // add the grid to the viewer GIS.Add( dst ) ; // update the viewer GIS.FullExtent ; end ;