GDAL
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.

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 **)
 Translates mnemonic gridding algorithm names into GDALGridAlgorithm code, parse control parameters and assign defaults.
 

Detailed Description

GDAL gridder related entry points and definitions.

Function Documentation

◆ GDALGridDataMetricAverageDistance()

CPLErr GDALGridDataMetricAverageDistance ( const void *  poOptionsIn,
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.

\[ Z=\frac{\sum_{i = 1}^n r_i}{n} \]

where

  • $Z$ is a resulting value at the grid node,
  • $r_i$ is an Euclidean distance from the grid node to point $i$,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridDataMetricsOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values (unused)
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridDataMetricAverageDistancePts()

CPLErr GDALGridDataMetricAverageDistancePts ( const void *  poOptionsIn,
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.

\[ Z=\frac{\sum_{i = 1}^{n-1}\sum_{j=i+1}^{n} r_{ij}}{\left(n-1\right)\,n-\frac{n+{\left(n-1\right)}^{2}-1}{2}} \]

where

  • $Z$ is a resulting value at the grid node,
  • $r_{ij}$ is an Euclidean distance between points $i$ and $j$,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridDataMetricsOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values (unused)
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridDataMetricCount()

CPLErr GDALGridDataMetricCount ( const void *  poOptionsIn,
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.

\[ Z=n \]

where

  • $Z$ is a resulting value at the grid node,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridDataMetricsOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridDataMetricMaximum()

CPLErr GDALGridDataMetricMaximum ( const void *  poOptionsIn,
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.

\[ Z=\max{(Z_1,Z_2,\ldots,Z_n)} \]

where

  • $Z$ is a resulting value at the grid node,
  • $Z_i$ is a known value at point $i$,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridDataMetricsOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridDataMetricMinimum()

CPLErr GDALGridDataMetricMinimum ( const void *  poOptionsIn,
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.

\[ Z=\min{(Z_1,Z_2,\ldots,Z_n)} \]

where

  • $Z$ is a resulting value at the grid node,
  • $Z_i$ is a known value at point $i$,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridDataMetricsOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInunused.
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridDataMetricRange()

CPLErr GDALGridDataMetricRange ( const void *  poOptionsIn,
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.

\[ Z=\max{(Z_1,Z_2,\ldots,Z_n)}-\min{(Z_1,Z_2,\ldots,Z_n)} \]

where

  • $Z$ is a resulting value at the grid node,
  • $Z_i$ is a known value at point $i$,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridDataMetricsOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridInverseDistanceToAPower()

CPLErr GDALGridInverseDistanceToAPower ( const void *  poOptionsIn,
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 $Z$ will be calculated using formula:

\[ Z=\frac{\sum_{i=1}^n{\frac{Z_i}{r_i^p}}}{\sum_{i=1}^n{\frac{1}{r_i^p}}} \]

where

  • $Z_i$ is a known value at point $i$,
  • $r_i$ is an Euclidean distance from the grid node to point $i$,
  • $p$ is a weighting power,
  • $n$ is a total number of points in search ellipse.

In this method the weighting factor $w$ is

\[ w=\frac{1}{r^p} \]

Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridInverseDistanceToAPowerOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridInverseDistanceToAPowerNearestNeighbor()

CPLErr GDALGridInverseDistanceToAPowerNearestNeighbor ( const void *  poOptionsIn,
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 $Z$ will be calculated using formula for nearest matches:

\[ Z=\frac{\sum_{i=1}^n{\frac{Z_i}{r_i^p}}}{\sum_{i=1}^n{\frac{1}{r_i^p}}} \]

where

  • $Z_i$ is a known value at point $i$,
  • $r_i$ is an Euclidean distance from the grid node to point $i$ (with an optional smoothing parameter $s$),
  • $p$ is a weighting power,
  • $n$ is a total number of points in search ellipse.

In this method the weighting factor $w$ is

\[ w=\frac{1}{r^p} \]

Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridInverseDistanceToAPowerNearestNeighborOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters.
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridInverseDistanceToAPowerNoSearch()

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

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()

◆ GDALGridLinear()

CPLErr GDALGridLinear ( const void *  poOptionsIn,
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 (radius != 0), or the nodata value (radius == 0)

Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridLinearOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsextra parameters
Returns
CE_None on success or CE_Failure if something goes wrong.
Since
GDAL 2.1

◆ GDALGridMovingAverage()

CPLErr GDALGridMovingAverage ( const void *  poOptionsIn,
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:

\[ Z=\frac{\sum_{i=1}^n{Z_i}}{n} \]

where

  • $Z$ is a resulting value at the grid node,
  • $Z_i$ is a known value at point $i$,
  • $n$ is a total number of points in search ellipse.
Parameters
poOptionsInAlgorithm parameters. This should point to GDALGridMovingAverageOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters (unused)
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALGridNearestNeighbor()

CPLErr GDALGridNearestNeighbor ( const void *  poOptionsIn,
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
poOptionsInAlgorithm parameters. This should point to GDALGridNearestNeighborOptions object.
nPointsNumber of elements in input arrays.
padfXInput array of X coordinates.
padfYInput array of Y coordinates.
padfZInput array of Z values.
dfXPointX coordinate of the point to compute.
dfYPointY coordinate of the point to compute.
pdfValuePointer to variable where the computed grid node value will be returned.
hExtraParamsInextra parameters.
Returns
CE_None on success or CE_Failure if something goes wrong.

Generated for GDAL by doxygen 1.8.13.