InterpolatingConverter Class

Class for performing a conversion inside a user specified area. It utilizes bilinear interpolation on a grid of pre-converted values.

The assumption is that the original conversion is fairly expensive, and accuracy is not as important as performance.

The conversion is pre-calculated on a grid inside the user specified area. The original expensive conversion will only be performed initially to create the pre-calculated grid values.

The accuracy of the bilinear interpolation depends on the grid spacing and the original conversion. The more non-linear the original conversion is, the smaller a grid spacing is required to get the same accuracy. Typical values of grid spacing dx to get app. 1 m accuracy:

  • Convert projection coordinates to another datum : dx ~ 100.000 m
  • Convert projection coordinates between two neighbouring UTM zones: dx ~ 10.000 m
  • Convert between geo and UTM projection coordinates at equator: dx ~ 20.000
  • Convert between geo and UTM projection coordinates at latitude ~ 55: dx ~ 5.000

Definition

Namespace: DHI.Projections
Assembly: DHI.Projections (in DHI.Projections.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class InterpolatingConverter
Inheritance
Object    InterpolatingConverter

Example

The InterpolatingConverterConversion delegate must be set up. To use a reprojector object as the original conversion, do: // Setup converter to use reprojector Reprojector reprojector = new Reprojector(sourceProjection, targetProjection); GridBufferConverter.Conversion conversion = delegate(ref double x, ref double y) { reprojector.Convert(ref x, ref y); }; GridBufferConverter converter = new GridBufferConverter(conversion); // Define the area to work on and the size of the pre-calculated grid converter.SetupArea(x0, y0, x1, y1); converter.SetupGridSize(xCount, yCount); converter.Initialize(); // Converter is now ready for use converter.Convert(ref x, ref y);

Constructors

InterpolatingConverter Create new object

Methods

CalculateErrorEstimate Calculate an estimate of the largest error for the provided dx and dy. The error estimate is calculated in the center of the domain, which may not be representative for the entire domain, so the error estimate is usually lower than the actual largest error.
CalculateGridSizeFromErrorEstimate Calculate and return a grid size estimate based on a max error. This only returns an indication, the actual error will usually be larger than the max error, for the returned grid size.

Grid size cannot be larger than extent of area in x and y direction.

Convert Convert the (x,y) coordinate
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Initialize Initialize buffer grid
SetupArea Setup the region that the buffer should cover. You must also call SetupGridSize(Int32, Int32) or SetupGridSpacing(Double, Double).
SetupGrid Setup manually region and buffer grid size
SetupGridSize Set up the size of the pre-calculated grid.

Call first SetupArea(Double, Double, Double, Double) before calling this

SetupGridSpacing Set up the grid spacing of the pre-calculated grid

Call first SetupArea(Double, Double, Double, Double) before calling this

ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also