User Tools

Site Tools


api:dk11:delphi:gisinterpolation.tgis_interpolationsplines

TGIS_InterpolationSplines class

DK11 for Delphi | GisInterpolation.TGIS_InterpolationSplines | Classes | Constructors | Methods | Properties

Implementation of the Completely Regularized Splines (CRS) interpolation method.

Available also on: .NET | Java | ActiveX.

Syntax

// Delphi
type
  TGIS_InterpolationSplines = class( TGIS_VectorToGridAbstract )
  end;
// C++ Builder
class PASCALIMPLEMENTATION TGIS_InterpolationSplines : public TGIS_VectorToGridAbstract
{
};

Inheritance

Constructors

Inherited Overrides Protected
Name Visibility Description
Create public

Methods

Inherited Overrides Protected
Name Visibility Description
Generate public Populates the pixel (grid) layer with the values resulting from computations based on the set of sample points from the vector layer.
(Overrides TGIS_VectorToGridAbstract.Generate)
raiseBusyEvent protected Prepares and raises the BusyEvent.
(Inherited from TGIS_VectorToGridAbstract)

Properties

Inherited Protected
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)
MaxPoints public The maximum number of input data points used to interpolate at each grid cell; default is 4.
MinPoints public The minimum number of input data points used to interpolate at each grid cell; default is 4.
Radius public Applies only to the windowed method (Windowed = True).
Tension public The tension (smoothing) factor.
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.

Remarks

IDW Splines Kriging Heatmap

Method

The principal of the Completely Regularized Splines interpolation method is to minimize the overall surface curvature. It produces the smoothest results among the vector-to-grid inerpolation techniques.

Usage

There are two different scenarios for generating an splines interpolated grid:

  1. based on a Z, M or Z+M coordinate value:
    • set the Coordinate property to the desired option
    • pass an empty string as the field name to the Generate method
  2. based on a attribute field value:
    • pass the field name to the Generate method
    • with above the Coordinate property is neglected

The Tension parameter is a smoothening factor - the smaller the tension the less rapid changes in the interpolated values. For best results it has to be experimentally adjusted for each input data. The most common values of Tension (good to start with) are in the range of 0,00001 to 0,1.

Use a windowed version of the algorithm (Windowed=True) for large datasets (thousands of points and more). For up to few hundred points the non-windowed (full sample) algorithm is efficient enough and gives best possible results. The Radius property is the size of the window in map units. The MinPoints/MaxPoints properties define the minimum/maximum number of sample points necessary/taken to interpolate a grid value.

Pros

  • smoothest results of all the inerpolation methods (if this is the goal)
  • interpolated values exceed the range of minimum to maximum values of the input data

Cons

  • for many applications (like terrain models) the results are too smooth and seem unnatural
  • works badly on input data with extreme value changes at short distances (amplifies the differences)

Example

// Delphi
<code delphi>
var
  src : TGIS_LayerVector ;
  dst : TGIS_LayerPixel ;
  vtg : TGIS_InterpolationSplines ;  
  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 splines interpolation engine
  vtg := TGIS_InterpolationSplines .Create ;
  try
    // attach event to track the progress
    vtg.BusyEvent := doBusyEvent ;
 
    // set the tension parameter
    vtg.Tension := 0.0001 ;
 
    // 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 ;

References

2019/01/25 16:26