GDAL

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Typedefs | Functions
gdalgrid.h File Reference

GDAL gridder related entry points and definitions. More...

`#include "gdal_alg.h"`

Go to the source code of this file.

## Typedefs
typedef CPLErr(* | GDALGridFunction )(const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)

## Functions
CPLErr | GDALGridInverseDistanceToAPower (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Inverse distance to a power. More...
CPLErr | GDALGridInverseDistanceToAPowerNearestNeighbor (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Inverse distance to a power with nearest neighbor search, ideal when max_points used. More...
CPLErr | GDALGridInverseDistanceToAPowerNoSearch (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Inverse distance to a power for whole data set. More...
CPLErr | GDALGridMovingAverage (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Moving average. More...
CPLErr | GDALGridNearestNeighbor (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Nearest neighbor. More...
CPLErr | GDALGridDataMetricMinimum (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Minimum data value (data metric). More...
CPLErr | GDALGridDataMetricMaximum (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Maximum data value (data metric). More...
CPLErr | GDALGridDataMetricRange (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Data range (data metric). More...
CPLErr | GDALGridDataMetricCount (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Number of data points (data metric). More...
CPLErr | GDALGridDataMetricAverageDistance (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Average distance (data metric). More...
CPLErr | GDALGridDataMetricAverageDistancePts (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Average distance between points (data metric). More...
CPLErr | GDALGridLinear (const void *, GUInt32, const double *, const double *, const double *, double, double, double *, void *)
| Linear interpolation. More...
CPLErr | ParseAlgorithmAndOptions (const char *, GDALGridAlgorithm *, void **)

## Detailed Description

GDAL gridder related entry points and definitions.

## Function Documentation

CPLErr GDALGridDataMetricAverageDistance | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Average distance (data metric).

An average distance between the grid node (center of the search ellipse) and all of the data points found in grid node search ellipse. If there are no points found, the specified NODATA value will be returned.

where

- is a resulting value at the grid node,
- is an Euclidean distance from the grid node to point ,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridDataMetricsOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridDataMetricAverageDistancePts | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Average distance between points (data metric).

An average distance between the data points found in grid node search ellipse. The distance between each pair of points within ellipse is calculated and average of all distances is set as a grid node value. If there are no points found, the specified NODATA value will be returned.

where

- is a resulting value at the grid node,
- is an Euclidean distance between points and ,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridDataMetricsOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridDataMetricCount | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Number of data points (data metric).

A number of data points found in grid node search ellipse.

where

- is a resulting value at the grid node,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridDataMetricsOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridDataMetricMaximum | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Maximum data value (data metric).

Maximum value found in grid node search ellipse. If there are no points found, the specified NODATA value will be returned.

where

- is a resulting value at the grid node,
- is a known value at point ,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridDataMetricsOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridDataMetricMinimum | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Minimum data value (data metric).

Minimum value found in grid node search ellipse. If there are no points found, the specified NODATA value will be returned.

where

- is a resulting value at the grid node,
- is a known value at point ,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridDataMetricsOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridDataMetricRange | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Data range (data metric).

A difference between the minimum and maximum values found in grid node search ellipse. If there are no points found, the specified NODATA value will be returned.

where

- is a resulting value at the grid node,
- is a known value at point ,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridDataMetricsOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridInverseDistanceToAPower | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Inverse distance to a power.

The Inverse Distance to a Power gridding method is a weighted average interpolator. You should supply the input arrays with the scattered data values including coordinates of every data point and output grid geometry. The function will compute interpolated value for the given position in output grid.

For every grid node the resulting value will be calculated using formula:

where

- is a known value at point ,
- is an Euclidean distance from the grid node to point ,
- is a weighting power,
- is a total number of points in search ellipse.

In this method the weighting factor is

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridInverseDistanceToAPowerOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.
  hExtraParamsIn | extra parameters.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridInverseDistanceToAPowerNearestNeighbor | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Inverse distance to a power with nearest neighbor search, ideal when max_points used.

The Inverse Distance to a Power gridding method is a weighted average interpolator. You should supply the input arrays with the scattered data values including coordinates of every data point and output grid geometry. The function will compute interpolated value for the given position in output grid.

For every grid node the resulting value will be calculated using formula for nearest matches:

where

- is a known value at point ,
- is an Euclidean distance from the grid node to point ,
- is a weighting power,
- is a total number of points in search ellipse.

In this method the weighting factor is

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridInverseDistanceToAPowerNearestNeighborOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.
  hExtraParamsIn | extra parameters.

Returns
  CE_None on success or CE_Failure if something goes wrong.

Examine all "neighbors" within the radius (sorted by distance via the multimap), and use the closest n points based on distance until the max is reached.

CPLErr GDALGridInverseDistanceToAPowerNoSearch | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Inverse distance to a power for whole data set.

This is somewhat optimized version of the Inverse Distance to a Power method. It is used when the search ellips is not set. The algorithm and parameters are the same as in GDALGridInverseDistanceToAPower(), but this implementation works faster, because of no search.

See also
  GDALGridInverseDistanceToAPower()

CPLErr GDALGridLinear | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParams
| ) |  |

Linear interpolation.

The Linear method performs linear interpolation by finding in which triangle of a Delaunay triangulation the point is, and by doing interpolation from its barycentric coordinates within the triangle. If the point is not in any triangle, depending on the radius, the algorithm will use the value of the nearest point or the nodata value.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridLinearOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

Since
  GDAL 2.1

CPLErr GDALGridMovingAverage | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Moving average.

The Moving Average is a simple data averaging algorithm. It uses a moving window of elliptic form to search values and averages all data points within the window. Search ellipse can be rotated by specified angle, the center of ellipse located at the grid node. Also the minimum number of data points to average can be set, if there are not enough points in window, the grid node considered empty and will be filled with specified NODATA value.

Mathematically it can be expressed with the formula:

where

- is a resulting value at the grid node,
- is a known value at point ,
- is a total number of points in search ellipse.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridMovingAverageOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALGridNearestNeighbor | ( | const void * | poOptions,
|  | GUInt32 | nPoints,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ,
|  | double | dfXPoint,
|  | double | dfYPoint,
|  | double * | pdfValue,
|  | void * | hExtraParamsIn
| ) |  |

Nearest neighbor.

The Nearest Neighbor method doesn't perform any interpolation or smoothing, it just takes the value of nearest point found in grid node search ellipse and returns it as a result. If there are no points found, the specified NODATA value will be returned.

Parameters

  poOptions | Algorithm parameters. This should point to GDALGridNearestNeighborOptions object.
  nPoints | Number of elements in input arrays.
  padfX | Input array of X coordinates.
  padfY | Input array of Y coordinates.
  padfZ | Input array of Z values.
  dfXPoint | X coordinate of the point to compute.
  dfYPoint | Y coordinate of the point to compute.
  pdfValue | Pointer to variable where the computed grid node value will be returned.

Returns
  CE_None on success or CE_Failure if something goes wrong.

Generated for GDAL by 1.8.8.