gdal_alg.h File Reference

#include "gdal.h"
#include "cpl_minixml.h"
#include "ogr_api.h"

Go to the source code of this file.

Classes

struct  GDALTransformerInfo
struct  OGRContourWriterInfo
struct  GDALGridInverseDistanceToAPowerOptions
struct  GDALGridMovingAverageOptions
struct  GDALGridNearestNeighborOptions
struct  GDALGridDataMetricsOptions

Typedefs

typedef int(* GDALTransformerFunc )(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
typedef CPLErr(* GDALContourWriter )(double dfLevel, int nPoints, double *padfX, double *padfY, void *)
typedef void * GDALContourGeneratorH

Enumerations

enum  GDALGridAlgorithm {
  GGA_InverseDistanceToAPower = 1, GGA_MovingAverage = 2, GGA_NearestNeighbor = 3, GGA_MetricMinimum = 4,
  GGA_MetricMaximum = 5, GGA_MetricRange = 6
}

Functions

int GDALComputeMedianCutPCT (GDALRasterBandH hRed, GDALRasterBandH hGreen, GDALRasterBandH hBlue, int(*pfnIncludePixel)(int, int, void *), int nColors, GDALColorTableH hColorTable, GDALProgressFunc pfnProgress, void *pProgressArg)
int GDALDitherRGB2PCT (GDALRasterBandH hRed, GDALRasterBandH hGreen, GDALRasterBandH hBlue, GDALRasterBandH hTarget, GDALColorTableH hColorTable, GDALProgressFunc pfnProgress, void *pProgressArg)
int GDALChecksumImage (GDALRasterBandH hBand, int nXOff, int nYOff, int nXSize, int nYSize)
CPLErr GDALComputeProximity (GDALRasterBandH hSrcBand, GDALRasterBandH hProximityBand, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
CPLErr GDALFillNodata (GDALRasterBandH hTargetBand, GDALRasterBandH hMaskBand, double dfMaxSearchDist, int bConicSearch, int nSmoothingIterations, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
CPLErr GDALPolygonize (GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand, OGRLayerH hOutLayer, int iPixValField, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
CPLErr GDALSieveFilter (GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand, GDALRasterBandH hDstBand, int nSizeThreshold, int nConnectedness, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
void GDALDestroyTransformer (void *pTransformerArg)
int GDALUseTransformer (void *pTranformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateGenImgProjTransformer (GDALDatasetH hSrcDS, const char *pszSrcWKT, GDALDatasetH hDstDS, const char *pszDstWKT, int bGCPUseOK, double dfGCPErrorThreshold, int nOrder)
void * GDALCreateGenImgProjTransformer2 (GDALDatasetH hSrcDS, GDALDatasetH hDstDS, char **papszOptions)
void GDALSetGenImgProjTransformerDstGeoTransform (void *, const double *)
void GDALDestroyGenImgProjTransformer (void *)
int GDALGenImgProjTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateReprojectionTransformer (const char *pszSrcWKT, const char *pszDstWKT)
void GDALDestroyReprojectionTransformer (void *)
int GDALReprojectionTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateGCPTransformer (int nGCPCount, const GDAL_GCP *pasGCPList, int nReqOrder, int bReversed)
void GDALDestroyGCPTransformer (void *pTransformArg)
int GDALGCPTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateTPSTransformer (int nGCPCount, const GDAL_GCP *pasGCPList, int bReversed)
void GDALDestroyTPSTransformer (void *pTransformArg)
int GDALTPSTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateRPCTransformer (GDALRPCInfo *psRPC, int bReversed, double dfPixErrThreshold, char **papszOptions)
void GDALDestroyRPCTransformer (void *pTransformArg)
int GDALRPCTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateGeoLocTransformer (GDALDatasetH hBaseDS, char **papszGeolocationInfo, int bReversed)
void GDALDestroyGeoLocTransformer (void *pTransformArg)
int GDALGeoLocTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateApproxTransformer (GDALTransformerFunc pfnRawTransformer, void *pRawTransformerArg, double dfMaxError)
void GDALApproxTransformerOwnsSubtransformer (void *pCBData, int bOwnFlag)
void GDALDestroyApproxTransformer (void *pApproxArg)
int GDALApproxTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
int GDALSimpleImageWarp (GDALDatasetH hSrcDS, GDALDatasetH hDstDS, int nBandCount, int *panBandList, GDALTransformerFunc pfnTransform, void *pTransformArg, GDALProgressFunc pfnProgress, void *pProgressArg, char **papszWarpOptions)
CPLErr GDALSuggestedWarpOutput (GDALDatasetH hSrcDS, GDALTransformerFunc pfnTransformer, void *pTransformArg, double *padfGeoTransformOut, int *pnPixels, int *pnLines)
CPLErr GDALSuggestedWarpOutput2 (GDALDatasetH hSrcDS, GDALTransformerFunc pfnTransformer, void *pTransformArg, double *padfGeoTransformOut, int *pnPixels, int *pnLines, double *padfExtents, int nOptions)
CPLXMLNodeGDALSerializeTransformer (GDALTransformerFunc pfnFunc, void *pTransformArg)
CPLErr GDALDeserializeTransformer (CPLXMLNode *psTree, GDALTransformerFunc *ppfnFunc, void **ppTransformArg)
GDALContourGeneratorH GDAL_CG_Create (int nWidth, int nHeight, int bNoDataSet, double dfNoDataValue, double dfContourInterval, double dfContourBase, GDALContourWriter pfnWriter, void *pCBData)
CPLErr GDAL_CG_FeedLine (GDALContourGeneratorH hCG, double *padfScanline)
void GDAL_CG_Destroy (GDALContourGeneratorH hCG)
CPLErr OGRContourWriter (double, int, double *, double *, void *pInfo)
CPLErr GDALContourGenerate (GDALRasterBandH hBand, double dfContourInterval, double dfContourBase, int nFixedLevelCount, double *padfFixedLevels, int bUseNoData, double dfNoDataValue, void *hLayer, int iIDField, int iElevField, GDALProgressFunc pfnProgress, void *pProgressArg)
CPLErr GDALRasterizeGeometries (GDALDatasetH hDS, int nBandCount, int *panBandList, int nGeomCount, OGRGeometryH *pahGeometries, GDALTransformerFunc pfnTransformer, void *pTransformArg, double *padfGeomBurnValue, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
CPLErr GDALRasterizeLayers (GDALDatasetH hDS, int nBandCount, int *panBandList, int nLayerCount, OGRLayerH *pahLayers, GDALTransformerFunc pfnTransformer, void *pTransformArg, double *padfLayerBurnValues, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
CPLErr GDALGridCreate (GDALGridAlgorithm, const void *, GUInt32, const double *, const double *, const double *, double, double, double, double, GUInt32, GUInt32, GDALDataType, void *, GDALProgressFunc, void *)

Detailed Description

Public (C callable) GDAL algorithm entry points, and definitions.


Typedef Documentation

Generic signature for spatial point transformers.

This function signature is used for a variety of functions that accept passed in functions used to transform point locations between two coordinate spaces.

The GDALCreateGenImgProjTransformer(), GDALCreateReprojectionTransformer(), GDALCreateGCPTransformer() and GDALCreateApproxTransformer() functions can be used to prepare argument data for some built-in transformers. As well, applications can implement their own transformers to the following signature.

typedef int 
(*GDALTransformerFunc)( void *pTransformerArg, 
                        int bDstToSrc, int nPointCount, 
                        double *x, double *y, double *z, int *panSuccess );
Parameters:
pTransformerArg application supplied callback data used by the transformer.
bDstToSrc if TRUE the transformation will be from the destination coordinate space to the source coordinate system, otherwise the transformation will be from the source coordinate system to the destination coordinate system.
nPointCount number of points in the x, y and z arrays.
x input X coordinates. Results returned in same array.
y input Y coordinates. Results returned in same array.
z input Z coordinates. Results returned in same array.
panSuccess array of ints in which success (TRUE) or failure (FALSE) flags are returned for the translation of each point.
Returns:
TRUE if the overall transformation succeeds (though some individual points may have failed) or FALSE if the overall transformation fails.

Enumeration Type Documentation

Gridding Algorithms

Enumerator:
GGA_InverseDistanceToAPower 

Inverse distance to a power

GGA_MovingAverage 

Moving Average

GGA_NearestNeighbor 

Nearest Neighbor

GGA_MetricMinimum 

Minimum Value (Data Metric)

GGA_MetricMaximum 

Maximum Value (Data Metric)

GGA_MetricRange 

Data Range (Data Metric)


Function Documentation

int GDALApproxTransform ( void *  pCBData,
int  bDstToSrc,
int  nPoints,
double *  x,
double *  y,
double *  z,
int *  panSuccess 
)

Perform approximate transformation.

Actually performs the approximate transformation described in GDALCreateApproxTransformer(). This function matches the GDALTransformerFunc() signature. Details of the arguments are described there.

References GDALApproxTransform().

Referenced by GDALApproxTransform(), GDALAutoCreateWarpedVRT(), GDALCreateApproxTransformer(), and GDALReprojectImage().

int GDALChecksumImage ( GDALRasterBandH  hBand,
int  nXOff,
int  nYOff,
int  nXSize,
int  nYSize 
)

Compute checksum for image region.

Computes a 16bit (0-65535) checksum from a region of raster data on a GDAL supported band. Floating point data is converted to 32bit integer so decimal portions of such raster data will not affect the checksum. Real and Imaginary components of complex bands influence the result.

Parameters:
hBand the raster band to read from.
nXOff pixel offset of window to read.
nYOff line offset of window to read.
nXSize pixel size of window to read.
nYSize line size of window to read.
Returns:
Checksum value.

References GDALChecksumImage(), GDALDataTypeIsComplex(), GDALGetRasterDataType(), GDALRasterIO(), GDT_CFloat32, GDT_CFloat64, GDT_CInt32, GDT_Float32, GDT_Float64, GDT_Int32, GF_Read, and VSIMalloc2().

Referenced by GDALChecksumImage().

int GDALComputeMedianCutPCT ( GDALRasterBandH  hRed,
GDALRasterBandH  hGreen,
GDALRasterBandH  hBlue,
int(*)(int, int, void *)  pfnIncludePixel,
int  nColors,
GDALColorTableH  hColorTable,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

Compute optimal PCT for RGB image.

This function implements a median cut algorithm to compute an "optimal" pseudocolor table for representing an input RGB image. This PCT could then be used with GDALDitherRGB2PCT() to convert a 24bit RGB image into an eightbit pseudo-colored image.

This code was based on the tiffmedian.c code from libtiff (www.libtiff.org) which was based on a paper by Paul Heckbert:

 *   "Color  Image Quantization for Frame Buffer Display", Paul
 *   Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307.
 * 

The red, green and blue input bands do not necessarily need to come from the same file, but they must be the same width and height. They will be clipped to 8bit during reading, so non-eight bit bands are generally inappropriate.

Parameters:
hRed Red input band.
hGreen Green input band.
hBlue Blue input band.
pfnIncludePixel function used to test which pixels should be included in the analysis. At this time this argument is ignored and all pixels are utilized. This should normally be NULL.
nColors the desired number of colors to be returned (2-256).
hColorTable the colors will be returned in this color table object.
pfnProgress callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
pProgressArg callback argument passed to pfnProgress.
Returns:
returns CE_None on success or CE_Failure if an error occurs.

References GDALColorEntry::c1, GDALColorEntry::c2, GDALColorEntry::c3, GDALColorEntry::c4, GDALComputeMedianCutPCT(), GDALGetRasterBandXSize(), GDALGetRasterBandYSize(), GDALRasterIO(), GDT_Byte, and GF_Read.

Referenced by GDALComputeMedianCutPCT().

CPLErr GDALContourGenerate ( GDALRasterBandH  hBand,
double  dfContourInterval,
double  dfContourBase,
int  nFixedLevelCount,
double *  padfFixedLevels,
int  bUseNoData,
double  dfNoDataValue,
void *  hLayer,
int  iIDField,
int  iElevField,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

Create vector contours from raster DEM.

This algorithm will generate contours vectors for the input raster band on the requested set of contour levels. The vector contours are written to the passed in OGR vector layer. Also, a NODATA value may be specified to identify pixels that should not be considered in contour line generation.

The gdal/apps/gdal_contour.cpp mainline can be used as an example of how to use this function.

ALGORITHM RULES

For contouring purposes raster pixel values are assumed to represent a point value at the center of the corresponding pixel region. For the purpose of contour generation we virtually connect each pixel center to the values to the left, right, top and bottom. We assume that the pixel value is linearly interpolated between the pixel centers along each line, and determine where (if any) contour lines will appear onlong these line segements. Then the contour crossings are connected.

This means that contour lines nodes won't actually be on pixel edges, but rather along vertical and horizontal lines connecting the pixel centers.

General Case:

      5 |                  | 3
     -- + ---------------- + -- 
        |                  |
        |                  |
        |                  |
        |                  |
     10 +                  |
        |\                 |
        | \                |
     -- + -+-------------- + -- 
     12 |  10              | 1


Saddle Point:

      5 |                  | 12
     -- + -------------+-- + -- 
        |               \  |
        |                 \|
        |                  + 
        |                  |
        +                  |
        |\                 |
        | \                |
     -- + -+-------------- + -- 
     12 |                  | 1

or:

      5 |                  | 12
     -- + -------------+-- + -- 
        |          __/     |
        |      ___/        |
        |  ___/          __+ 
        | /           __/  |
        +'         __/     |
        |       __/        |
        |   ,__/           |
     -- + -+-------------- + -- 
     12 |                  | 1

Nodata:

In the "nodata" case we treat the whole nodata pixel as a no-mans land. We extend the corner pixels near the nodata out to half way and then construct extra lines from those points to the center which is assigned an averaged value from the two nearby points (in this case (12+3+5)/3).

      5 |                  | 3
     -- + ---------------- + -- 
        |                  |
        |                  |
        |      6.7         |
        |        +---------+ 3
     10 +___     |          
        |   \____+ 10       
        |        |          
     -- + -------+        +    
     12 |       12           (nodata)

Parameters:
hBand The band to read raster data from. The whole band will be processed.
dfContourInterval The elevation interval between contours generated.
dfContourBase The "base" relative to which contour intervals are applied. This is normally zero, but could be different. To generate 10m contours at 5, 15, 25, ... the ContourBase would be 5.
nFixedLevelCount The number of fixed levels. If this is greater than zero, then fixed levels will be used, and ContourInterval and ContourBase are ignored.
padfFixedLevels The list of fixed contour levels at which contours should be generated. It will contain FixedLevelCount entries, and may be NULL if fixed levels are disabled (FixedLevelCount = 0).
bUseNoData If TRUE the dfNoDataValue will be used.
dfNoDataValue the value to use as a "nodata" value. That is, a pixel value which should be ignored in generating contours as if the value of the pixel were not known.
hLayer the layer to which new contour vectors will be written. Each contour will have a LINESTRING geometry attached to it. This is really of type OGRLayerH, but void * is used to avoid pulling the ogr_api.h file in here.
iIDField if not -1 this will be used as a field index to indicate where a unique id should be written for each feature (contour) written.
iElevField if not -1 this will be used as a field index to indicate where the elevation value of the contour should be written.
pfnProgress a GDALProgressFunc that may be used to report progress to the user, or to interrupt the algorithm. May be NULL if not required.
pProgressArg the callback data for the pfnProgress function.
Returns:
CE_None on success or CE_Failure if an error occurs.

References GDALGetBandDataset(), GDALGetGeoTransform(), GDALGetRasterBandXSize(), GDALGetRasterBandYSize(), GDALRasterIO(), GDT_Float64, and GF_Read.

void* GDALCreateApproxTransformer ( GDALTransformerFunc  pfnBaseTransformer,
void *  pBaseTransformArg,
double  dfMaxError 
)

Create an approximating transformer.

This function creates a context for an approximated transformer. Basically a high precision transformer is supplied as input and internally linear approximations are computed to generate results to within a defined precision.

The approximation is actually done at the point where GDALApproxTransform() calls are made, and depend on the assumption that the roughly linear. The first and last point passed in must be the extreme values and the intermediate values should describe a curve between the end points. The approximator transforms and center using the approximate transformer, and then compares the true middle transformed value to a linear approximation based on the end points. If the error is within the supplied threshold then the end points are used to linearly approximate all the values otherwise the inputs points are split into two smaller sets, and the function recursively called till a sufficiently small set of points if found that the linear approximation is OK, or that all the points are exactly computed.

This function is very suitable for approximating transformation results from output pixel/line space to input coordinates for warpers that operate on one input scanline at a time. Care should be taken using it in other circumstances as little internal validation is done, in order to keep things fast.

Parameters:
pfnBaseTransformer the high precision transformer which should be approximated.
pBaseTransformArg the callback argument for the high precision transformer.
dfMaxError the maximum cartesian error in the "output" space that is to be accepted in the linear approximation.
Returns:
callback pointer suitable for use with GDALApproxTransform(). It should be deallocated with GDALDestroyApproxTransformer().

References GDALApproxTransform(), GDALCreateApproxTransformer(), and GDALDestroyApproxTransformer().

Referenced by GDALAutoCreateWarpedVRT(), GDALCreateApproxTransformer(), and GDALReprojectImage().

void* GDALCreateGCPTransformer ( int  nGCPCount,
const GDAL_GCP pasGCPList,
int  nReqOrder,
int  bReversed 
)

Create GCP based polynomial transformer.

Computes least squares fit polynomials from a provided set of GCPs, and stores the coefficients for later transformation of points between pixel/line and georeferenced coordinates.

The return value should be used as a TransformArg in combination with the transformation function GDALGCPTransform which fits the GDALTransformerFunc signature. The returned transform argument should be deallocated with GDALDestroyGCPTransformer when no longer needed.

This function may fail (returning NULL) if the provided set of GCPs are inadequate for the requested order, the determinate is zero or they are otherwise "ill conditioned".

Note that 2nd order requires at least 6 GCPs, and 3rd order requires at least 10 gcps. If nReqOrder is 0 the highest order possible with the provided gcp count will be used.

Parameters:
nGCPCount the number of GCPs in pasGCPList.
pasGCPList an array of GCPs to be used as input.
nReqOrder the requested polynomial order. It should be 1, 2 or 3.
Returns:
the transform argument or NULL if creation fails.

References GDAL_GCP::dfGCPLine, GDAL_GCP::dfGCPPixel, GDAL_GCP::dfGCPX, GDAL_GCP::dfGCPY, GDALCreateGCPTransformer(), GDALDestroyGCPTransformer(), and GDALGCPTransform().

Referenced by GDALCreateGCPTransformer(), and GDALCreateGenImgProjTransformer2().

void* GDALCreateGenImgProjTransformer ( GDALDatasetH  hSrcDS,
const char *  pszSrcWKT,
GDALDatasetH  hDstDS,
const char *  pszDstWKT,
int  bGCPUseOK,
double  dfGCPErrorThreshold,
int  nOrder 
)

Create image to image transformer.

This function creates a transformation object that maps from pixel/line coordinates on one image to pixel/line coordinates on another image. The images may potentially be georeferenced in different coordinate systems, and may used GCPs to map between their pixel/line coordinates and georeferenced coordinates (as opposed to the default assumption that their geotransform should be used).

This transformer potentially performs three concatenated transformations.

The first stage is from source image pixel/line coordinates to source image georeferenced coordinates, and may be done using the geotransform, or if not defined using a polynomial model derived from GCPs. If GCPs are used this stage is accomplished using GDALGCPTransform().

The second stage is to change projections from the source coordinate system to the destination coordinate system, assuming they differ. This is accomplished internally using GDALReprojectionTransform().

The third stage is converting from destination image georeferenced coordinates to destination image coordinates. This is done using the destination image geotransform, or if not available, using a polynomial model derived from GCPs. If GCPs are used this stage is accomplished using GDALGCPTransform(). This stage is skipped if hDstDS is NULL when the transformation is created.

Parameters:
hSrcDS source dataset, or NULL.
pszSrcWKT the coordinate system for the source dataset. If NULL, it will be read from the dataset itself.
hDstDS destination dataset (or NULL).
pszDstWKT the coordinate system for the destination dataset. If NULL, and hDstDS not NULL, it will be read from the destination dataset.
bGCPUseOK TRUE if GCPs should be used if the geotransform is not available on the source dataset (not destination).
dfGCPErrorThreshold ignored/deprecated.
nOrder the maximum order to use for GCP derived polynomials if possible. Use 0 to autoselect, or -1 for thin plate splines.
Returns:
handle suitable for use GDALGenImgProjTransform(), and to be deallocated with GDALDestroyGenImgProjTransformer().

References GDALCreateGenImgProjTransformer(), and GDALCreateGenImgProjTransformer2().

Referenced by GDALAutoCreateWarpedVRT(), GDALCreateGenImgProjTransformer(), GDALRasterizeGeometries(), and GDALReprojectImage().

void* GDALCreateGenImgProjTransformer2 ( GDALDatasetH  hSrcDS,
GDALDatasetH  hDstDS,
char **  papszOptions 
)

Create image to image transformer.

This function creates a transformation object that maps from pixel/line coordinates on one image to pixel/line coordinates on another image. The images may potentially be georeferenced in different coordinate systems, and may used GCPs to map between their pixel/line coordinates and georeferenced coordinates (as opposed to the default assumption that their geotransform should be used).

This transformer potentially performs three concatenated transformations.

The first stage is from source image pixel/line coordinates to source image georeferenced coordinates, and may be done using the geotransform, or if not defined using a polynomial model derived from GCPs. If GCPs are used this stage is accomplished using GDALGCPTransform().

The second stage is to change projections from the source coordinate system to the destination coordinate system, assuming they differ. This is accomplished internally using GDALReprojectionTransform().

The third stage is converting from destination image georeferenced coordinates to destination image coordinates. This is done using the destination image geotransform, or if not available, using a polynomial model derived from GCPs. If GCPs are used this stage is accomplished using GDALGCPTransform(). This stage is skipped if hDstDS is NULL when the transformation is created.

Supported Options:

  • SRC_SRS: WKT SRS to be used as an override for hSrcDS.
  • DST_SRS: WKT SRS to be used as an override for hDstDS.
  • GCPS_OK: If false, GCPs will not be used, default is TRUE.
  • MAX_GCP_ORDER: the maximum order to use for GCP derived polynomials if possible. The default is to autoselect based on the number of GCPs. A value of -1 triggers use of Thin Plate Spline instead of polynomials.
  • METHOD: may have a value which is one of GEOTRANSFORM, GCP_POLYNOMIAL, GCP_TPS, GEOLOC_ARRAY, RPC to force only one geolocation method to be considered on the source dataset.
  • RPC_HEIGHT: A fixed height to be used with RPC calculations.
  • RPC_DEM: The name of a DEM file to be used with RPC calculations.
Parameters:
hSrcDS source dataset, or NULL.
hDstDS destination dataset (or NULL).
Returns:
handle suitable for use GDALGenImgProjTransform(), and to be deallocated with GDALDestroyGenImgProjTransformer() or NULL on failure.

References GDALCreateGCPTransformer(), GDALCreateGenImgProjTransformer2(), GDALCreateReprojectionTransformer(), GDALCreateRPCTransformer(), GDALCreateTPSTransformer(), GDALDestroyGenImgProjTransformer(), GDALGenImgProjTransform(), GDALGetDescription(), GDALGetGCPCount(), GDALGetGCPProjection(), GDALGetGCPs(), GDALGetGeoTransform(), GDALGetMetadata(), GDALGetProjectionRef(), and GDALInvGeoTransform().

Referenced by GDALCreateGenImgProjTransformer(), and GDALCreateGenImgProjTransformer2().

void* GDALCreateReprojectionTransformer ( const char *  pszSrcWKT,
const char *  pszDstWKT 
)

Create reprojection transformer.

Creates a callback data structure suitable for use with GDALReprojectionTransformation() to represent a transformation from one geographic or projected coordinate system to another. On input the coordinate systems are described in OpenGIS WKT format.

Internally the OGRCoordinateTransformation object is used to implement the reprojection.

Parameters:
pszSrcWKT the coordinate system for the source coordinate system.
pszDstWKT the coordinate system for the destination coordinate system.
Returns:
Handle for use with GDALReprojectionTransform(), or NULL if the system fails to initialize the reprojection.

References GDALCreateReprojectionTransformer(), GDALDestroyReprojectionTransformer(), and GDALReprojectionTransform().

Referenced by GDALCreateGenImgProjTransformer2(), and GDALCreateReprojectionTransformer().

void* GDALCreateRPCTransformer ( GDALRPCInfo psRPCInfo,
int  bReversed,
double  dfPixErrThreshold,
char **  papszOptions 
)

Create an RPC based transformer.

The geometric sensor model describing the physical relationship between image coordinates and ground coordinate is known as a Rigorous Projection Model. A Rigorous Projection Model expresses the mapping of the image space coordinates of rows and columns (r,c) onto the object space reference surface geodetic coordinates (long, lat, height).

RPC supports a generic description of the Rigorous Projection Models. The approximation used by GDAL (RPC00) is a set of rational polynomials exp ressing the normalized row and column values, (rn , cn), as a function of normalized geodetic latitude, longitude, and height, (P, L, H), given a set of normalized polynomial coefficients (LINE_NUM_COEF_n, LINE_DEN_COEF_n, SAMP_NUM_COEF_n, SAMP_DEN_COEF_n). Normalized values, rather than actual values are used in order to minimize introduction of errors during the calculations. The transformation between row and column values (r,c), and normalized row and column values (rn, cn), and between the geodetic latitude, longitude, and height and normalized geodetic latitude, longitude, and height (P, L, H), is defined by a set of normalizing translations (offsets) and scales that ensure all values are contained i the range -1 to +1.

This function creates a GDALTransformFunc compatible transformer for going between image pixel/line and long/lat/height coordinates using RPCs. The RPCs are provided in a GDALRPCInfo structure which is normally read from metadata using GDALExtractRPCInfo().

GDAL RPC Metadata has the following entries (also described in GDAL RFC 22 and the GeoTIFF RPC document http://geotiff.maptools.org/rpc_prop.html.

  • ERR_BIAS: Error - Bias. The RMS bias error in meters per horizontal axis of all points in the image (-1.0 if unknown)
  • ERR_RAND: Error - Random. RMS random error in meters per horizontal axis of each point in the image (-1.0 if unknown)
  • LINE_OFF: Line Offset
  • SAMP_OFF: Sample Offset
  • LAT_OFF: Geodetic Latitude Offset
  • LONG_OFF: Geodetic Longitude Offset
  • HEIGHT_OFF: Geodetic Height Offset
  • LINE_SCALE: Line Scale
  • SAMP_SCALE: Sample Scale
  • LAT_SCALE: Geodetic Latitude Scale
  • LONG_SCALE: Geodetic Longitude Scale
  • HEIGHT_SCALE: Geodetic Height Scale
  • LINE_NUM_COEFF (1-20): Line Numerator Coefficients. Twenty coefficients for the polynomial in the Numerator of the rn equation. (space separated)
  • LINE_DEN_COEFF (1-20): Line Denominator Coefficients. Twenty coefficients for the polynomial in the Denominator of the rn equation. (space separated)
  • SAMP_NUM_COEFF (1-20): Sample Numerator Coefficients. Twenty coefficients for the polynomial in the Numerator of the cn equation. (space separated)
  • SAMP_DEN_COEFF (1-20): Sample Denominator Coefficients. Twenty coefficients for the polynomial in the Denominator of the cn equation. (space separated)

The transformer normally maps from pixel/line/height to long/lat/height space as a forward transformation though in RPC terms that would be considered an inverse transformation (and is solved by iterative approximation using long/lat/height to pixel/line transformations). The default direction can be reversed by passing bReversed=TRUE.

The iterative solution of pixel/line to lat/long/height is currently run for up to 10 iterations or until the apparent error is less than dfPixErrThreshold pixels. Passing zero will not avoid all error, but will cause the operation to run for the maximum number of iterations.

Additional options to the transformer can be supplied in papszOptions. Currently only one option is supported, though in the future more may be added, notably an option to extract elevation offsets from a DEM file.

Options:

  • RPC_HEIGHT: a fixed height offset to be applied to all points passed in. In this situation the Z passed into the transformation function is assumed to be height above ground, and the RPC_HEIGHT is assumed to be an average height above sea level for ground in the target scene.
Parameters:
psRPCInfo Definition of the RPC parameters.
bReversed If true "forward" transformation will be lat/long to pixel/line instead of the normal pixel/line to lat/long.
dfPixErrThreshold the error (measured in pixels) allowed in the iterative solution of pixel/line to lat/long computations (the other way is always exact given the equations).
papszOptions Other transformer options (ie. RPC_HEIGHT=<z>).
Returns:
transformer callback data (deallocate with GDALDestroyTransformer()).

References CPLAtof(), GDALCreateRPCTransformer(), and GDALInvGeoTransform().

Referenced by GDALCreateGenImgProjTransformer2(), and GDALCreateRPCTransformer().

void* GDALCreateTPSTransformer ( int  nGCPCount,
const GDAL_GCP pasGCPList,
int  bReversed 
)

Create Thin Plate Spline transformer from GCPs.

The thin plate spline transformer produces exact transformation at all control points and smoothly varying transformations between control points with greatest influence from local control points. It is suitable for for many applications not well modelled by polynomial transformations.

Creating the TPS transformer involves solving systems of linear equations related to the number of control points involved. This solution is computed within this function call. It can be quite an expensive operation for large numbers of GCPs. For instance, for reference, it takes on the order of 10s for 400 GCPs on a 2GHz Athlon processor.

TPS Transformers are serializable.

The GDAL Thin Plate Spline transformer is based on code provided by Gilad Ronnen on behalf of VIZRT Inc (http://www.visrt.com). Incorporation of the algorithm into GDAL was supported by the Centro di Ecologia Alpina (http://www.cealp.it).

Parameters:
nGCPCount the number of GCPs in pasGCPList.
pasGCPList an array of GCPs to be used as input. bReversed
Returns:
the transform argument or NULL if creation fails.

References GDAL_GCP::dfGCPLine, GDAL_GCP::dfGCPPixel, GDAL_GCP::dfGCPX, GDAL_GCP::dfGCPY, GDALCreateTPSTransformer(), GDALDestroyTPSTransformer(), and GDALTPSTransform().

Referenced by GDALCreateGenImgProjTransformer2(), and GDALCreateTPSTransformer().

void GDALDestroyApproxTransformer ( void *  pCBData  ) 

Cleanup approximate transformer.

Deallocates the resources allocated by GDALCreateApproxTransformer().

Parameters:
pCBData callback data originally returned by GDALCreateApproxTransformer().

References GDALDestroyApproxTransformer().

Referenced by GDALCreateApproxTransformer(), GDALDestroyApproxTransformer(), and GDALReprojectImage().

void GDALDestroyGCPTransformer ( void *  pTransformArg  ) 

Destroy GCP transformer.

This function is used to destroy information about a GCP based polynomial transformation created with GDALCreateGCPTransformer().

Parameters:
pTransformArg the transform arg previously returned by GDALCreateGCPTransformer().

References GDALDestroyGCPTransformer().

Referenced by GDALCreateGCPTransformer(), GDALDestroyGCPTransformer(), and GDALDestroyGenImgProjTransformer().

void GDALDestroyGenImgProjTransformer ( void *  hTransformArg  ) 

GenImgProjTransformer deallocator.

This function is used to deallocate the handle created with GDALCreateGenImgProjTransformer().

Parameters:
hTransformArg the handle to deallocate.

References GDALDestroyGCPTransformer(), GDALDestroyGenImgProjTransformer(), GDALDestroyReprojectionTransformer(), and GDALDestroyTPSTransformer().

Referenced by GDALCreateGenImgProjTransformer2(), GDALDestroyGenImgProjTransformer(), and GDALReprojectImage().

void GDALDestroyReprojectionTransformer ( void *  pTransformAlg  ) 

Destroy reprojection transformation.

Parameters:
pTransformArg the transformation handle returned by GDALCreateReprojectionTransformer().

References GDALDestroyReprojectionTransformer().

Referenced by GDALCreateReprojectionTransformer(), GDALDestroyGenImgProjTransformer(), and GDALDestroyReprojectionTransformer().

void GDALDestroyTPSTransformer ( void *  pTransformArg  ) 

Destroy TPS transformer.

This function is used to destroy information about a GCP based polynomial transformation created with GDALCreateTPSTransformer().

Parameters:
pTransformArg the transform arg previously returned by GDALCreateTPSTransformer().

References GDALDestroyTPSTransformer().

Referenced by GDALCreateTPSTransformer(), GDALDestroyGenImgProjTransformer(), and GDALDestroyTPSTransformer().

int GDALDitherRGB2PCT ( GDALRasterBandH  hRed,
GDALRasterBandH  hGreen,
GDALRasterBandH  hBlue,
GDALRasterBandH  hTarget,
GDALColorTableH  hColorTable,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

24bit to 8bit conversion with dithering.

This functions utilizes Floyd-Steinberg dithering in the process of converting a 24bit RGB image into a pseudocolored 8bit image using a provided color table.

The red, green and blue input bands do not necessarily need to come from the same file, but they must be the same width and height. They will be clipped to 8bit during reading, so non-eight bit bands are generally inappropriate. Likewise the hTarget band will be written with 8bit values and must match the width and height of the source bands.

The color table cannot have more than 256 entries.

Parameters:
hRed Red input band.
hGreen Green input band.
hBlue Blue input band.
hTarget Output band.
hColorTable the color table to use with the output band.
pfnProgress callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
pProgressArg callback argument passed to pfnProgress.
Returns:
CE_None on success or CE_Failure if an error occurs.

References GDALColorEntry::c1, GDALColorEntry::c2, GDALColorEntry::c3, GDALDitherRGB2PCT(), GDALGetRasterBandXSize(), GDALGetRasterBandYSize(), GDALRasterIO(), GDT_Byte, GF_Read, and GF_Write.

Referenced by GDALDitherRGB2PCT().

int GDALGCPTransform ( void *  pTransformArg,
int  bDstToSrc,
int  nPointCount,
double *  x,
double *  y,
double *  z,
int *  panSuccess 
)

Transforms point based on GCP derived polynomial model.

This function matches the GDALTransformerFunc signature, and can be used to transform one or more points from pixel/line coordinates to georeferenced coordinates (SrcToDst) or vice versa (DstToSrc).

Parameters:
pTransformArg return value from GDALCreateGCPTransformer().
bDstToSrc TRUE if transformation is from the destination (georeferenced) coordinates to pixel/line or FALSE when transforming from pixel/line to georeferenced coordinates.
nPointCount the number of values in the x, y and z arrays.
x array containing the X values to be transformed.
y array containing the Y values to be transformed.
z array containing the Z values to be transformed.
panSuccess array in which a flag indicating success (TRUE) or failure (FALSE) of the transformation are placed.
Returns:
TRUE.

References GDALGCPTransform().

Referenced by GDALCreateGCPTransformer(), GDALGCPTransform(), and GDALGenImgProjTransform().

int GDALGenImgProjTransform ( void *  pTransformArg,
int  bDstToSrc,
int  nPointCount,
double *  padfX,
double *  padfY,
double *  padfZ,
int *  panSuccess 
)

Perform general image reprojection transformation.

Actually performs the transformation setup in GDALCreateGenImgProjTransformer(). This function matches the signature required by the GDALTransformerFunc(), and more details on the arguments can be found in that topic.

References GDALGCPTransform(), GDALGenImgProjTransform(), GDALReprojectionTransform(), and GDALTPSTransform().

Referenced by GDALAutoCreateWarpedVRT(), GDALCreateGenImgProjTransformer2(), GDALGenImgProjTransform(), GDALRasterizeGeometries(), and GDALReprojectImage().

CPLErr GDALGridCreate ( GDALGridAlgorithm  eAlgorithm,
const void *  poOptions,
GUInt32  nPoints,
const double *  padfX,
const double *  padfY,
const double *  padfZ,
double  dfXMin,
double  dfXMax,
double  dfYMin,
double  dfYMax,
GUInt32  nXSize,
GUInt32  nYSize,
GDALDataType  eType,
void *  pData,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

Create regular grid from the scattered data.

This fucntion takes the arrays of X and Y coordinates and corresponding Z values as input and computes regular grid (or call it a raster) from these scattered data. You should supply geometry and extent of the output grid and allocate array sufficient to hold such a grid.

Parameters:
eAlgorithm Gridding method.
poOptions Options to control choosen gridding method.
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.
dfXMin Lowest X border of output grid.
dfXMax Highest X border of output grid.
dfYMin Lowest Y border of output grid.
dfYMax Highest Y border of output grid.
nXSize Number of columns in output grid.
nYSize Number of rows in output grid.
eType Data type of output array.
pData Pointer to array where the computed grid will be stored.
pfnProgress a GDALProgressFunc() compatible callback function for reporting progress or NULL.
pProgressArg argument to be passed to pfnProgress. May be NULL.
Returns:
CE_None on success or CE_Failure if something goes wrong.

References GDALGridCreate(), GDT_Byte, GDT_Float32, GDT_Float64, GDT_Int16, GDT_Int32, GDT_UInt16, GDT_UInt32, GGA_InverseDistanceToAPower, GGA_MetricMaximum, GGA_MetricMinimum, GGA_MetricRange, GGA_MovingAverage, and GGA_NearestNeighbor.

Referenced by GDALGridCreate().

CPLErr GDALPolygonize ( GDALRasterBandH  hSrcBand,
GDALRasterBandH  hMaskBand,
OGRLayerH  hOutLayer,
int  iPixValField,
char **  papszOptions,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

Create polygon coverage from raster data.

This function creates vector polygons for all connected regions of pixels in the raster sharing a common pixel value. Optionally each polygon may be labelled with the pixel value in an attribute. Optionally a mask band can be provided to determine which pixels are eligible for processing.

Note that currently the source pixel band values are read into a signed 32bit integer buffer (Int32), so floating point or complex bands will be implicitly truncated before processing.

Polygon features will be created on the output layer, with polygon geometries representing the polygons. The polygon geometries will be in the georeferenced coordinate system of the image (based on the geotransform of the source dataset). It is acceptable for the output layer to already have features. Note that GDALPolygonize() does not set the coordinate system on the output layer. Application code should do this when the layer is created, presumably matching the raster coordinate system.

The algorithm used attempts to minimize memory use so that very large rasters can be processed. However, if the raster has many polygons or very large/complex polygons, the memory use for holding polygon enumerations and active polygon geometries may grow to be quite large.

The algorithm will generally produce very dense polygon geometries, with edges that follow exactly on pixel boundaries for all non-interior pixels. For non-thematic raster data (such as satellite images) the result will essentially be one small polygon per pixel, and memory and output layer sizes will be substantial. The algorithm is primarily intended for relatively simple thematic imagery, masks, and classification results.

Parameters:
hSrcBand the source raster band to be processed.
hMaskBand an optional mask band. All pixels in the mask band with a value other than zero will be considered suitable for collection as polygons.
hOutLayer the vector feature layer to which the polygons should be written.
iPixValField the attribute field index indicating the feature attribute into which the pixel value of the polygon should be written.
papszOptions a name/value list of additional options (none currently supported).
pfnProgress callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
pProgressArg callback argument passed to pfnProgress.
Returns:
CE_None on success or CE_Failure on a failure.

References GDALGetBandDataset(), GDALGetGeoTransform(), GDALGetRasterBandXSize(), GDALGetRasterBandYSize(), GDALPolygonize(), GDALRasterIO(), GDT_Int32, and GF_Read.

Referenced by GDALPolygonize().

CPLErr GDALRasterizeGeometries ( GDALDatasetH  hDS,
int  nBandCount,
int *  panBandList,
int  nGeomCount,
OGRGeometryH *  pahGeometries,
GDALTransformerFunc  pfnTransformer,
void *  pTransformArg,
double *  padfGeomBurnValue,
char **  papszOptions,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

Burn geometries into raster.

Rasterize a list of geometric objects into a raster dataset. The geometries are passed as an array of OGRGeometryH handlers.

If the geometries are in the georferenced coordinates of the raster dataset, then the pfnTransform may be passed in NULL and one will be derived internally from the geotransform of the dataset. The transform needs to transform the geometry locations into pixel/line coordinates on the raster dataset.

The output raster may be of any GDAL supported datatype, though currently internally the burning is done either as GDT_Byte or GDT_Float32. This may be improved in the future. An explicit list of burn values for each geometry for each band must be passed in.

Parameters:
hDS output data, must be opened in update mode.
nBandCount the number of bands to be updated.
panBandList the list of bands to be updated.
nGeomCount the number of geometries being passed in pahGeometries.
pahGeometries the array of geometries to burn in.
pfnTransformer transformation to apply to geometries to put into pixel/line coordinates on raster. If NULL a geotransform based one will be created internally.
pTransformerArg callback data for transformer.
padfGeomBurnValue the array of values to burn into the raster. There should be nBandCount values for each geometry.
papszOption special options controlling rasterization, currently none are defined.
pfnProgress the progress function to report completion.
pProgressArg callback data for progress function.
Returns:
CE_None on success or CE_Failure on error.

References GDALCreateGenImgProjTransformer(), GDALGenImgProjTransform(), GDALGetDataTypeSize(), GDALRasterizeGeometries(), GDT_Byte, GDT_Float32, GDALDataset::GetRasterBand(), GDALRasterBand::GetRasterDataType(), GDALDataset::GetRasterXSize(), GDALDataset::GetRasterYSize(), GF_Read, GF_Write, and GDALDataset::RasterIO().

Referenced by GDALRasterizeGeometries().

int GDALReprojectionTransform ( void *  pTransformArg,
int  bDstToSrc,
int  nPointCount,
double *  padfX,
double *  padfY,
double *  padfZ,
int *  panSuccess 
)

Perform reprojection transformation.

Actually performs the reprojection transformation described in GDALCreateReprojectionTransformer(). This function matches the GDALTransformerFunc() signature. Details of the arguments are described there.

References GDALReprojectionTransform().

Referenced by GDALCreateReprojectionTransformer(), GDALGenImgProjTransform(), and GDALReprojectionTransform().

void GDALSetGenImgProjTransformerDstGeoTransform ( void *  hTransformArg,
const double *  padfGeoTransform 
)

Set GenImgProj output geotransform.

Normally the "destination geotransform", or transformation between georeferenced output coordinates and pixel/line coordinates on the destination file is extracted from the destination file by GDALCreateGenImgProjTransformer() and stored in the GenImgProj private info. However, sometimes it is inconvenient to have an output file handle with appropriate geotransform information when creating the transformation. For these cases, this function can be used to apply the destination geotransform.

Parameters:
hTransformArg the handle to update.
padfGeoTransform the destination geotransform to apply (six doubles).

References GDALInvGeoTransform(), and GDALSetGenImgProjTransformerDstGeoTransform().

Referenced by GDALAutoCreateWarpedVRT(), and GDALSetGenImgProjTransformerDstGeoTransform().

CPLErr GDALSieveFilter ( GDALRasterBandH  hSrcBand,
GDALRasterBandH  hMaskBand,
GDALRasterBandH  hDstBand,
int  nSizeThreshold,
int  nConnectedness,
char **  papszOptions,
GDALProgressFunc  pfnProgress,
void *  pProgressArg 
)

Removes small raster polygons.

The function removes raster polygons smaller than a provided threshold size (in pixels) and replaces replaces them with the pixel value of the largest neighbour polygon.

Polygon are determined (per GDALRasterPolygonEnumerator) as regions of the raster where the pixels all have the same value, and that are contiguous (connected).

Pixels determined to be "nodata" per hMaskBand will not be treated as part of a polygon regardless of their pixel values. Nodata areas will never be changed nor affect polygon sizes.

Polygons smaller than the threshold with no neighbours that are as large as the threshold will not be altered. Polygons surrounded by nodata areas will therefore not be altered.

The algorithm makes three passes over the input file to enumerate the polygons and collect limited information about them. Memory use is proportional to the number of polygons (roughly 24 bytes per polygon), but is not directly related to the size of the raster. So very large raster files can be processed effectively if there aren't too many polygons. But extremely noisy rasters with many one pixel polygons will end up being expensive (in memory) to process.

Parameters:
hSrcBand the source raster band to be processed.
hMaskBand an optional mask band. All pixels in the mask band with a value other than zero will be considered suitable for inclusion in polygons.
hDstBand the output raster band. It may be the same as hSrcBand to update the source in place.
nSizeThreshold raster polygons with sizes smaller than this will be merged into their largest neighbour.
nConnectedness either 4 indicating that diagonal pixels are not considered directly adjacent for polygon membership purposes or 8 indicating they are.
papszOption algorithm options in name=value list form. None currently supported.
pfnProgress callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
pProgressArg callback argument passed to pfnProgress.
Returns:
CE_None on success or CE_Failure if an error occurs.

References GDALGetRasterBandXSize(), GDALGetRasterBandYSize(), GDALRasterIO(), GDALSieveFilter(), GDT_Int32, GF_Read, and GF_Write.

Referenced by GDALSieveFilter().

int GDALSimpleImageWarp ( GDALDatasetH  hSrcDS,
GDALDatasetH  hDstDS,
int  nBandCount,
int *  panBandList,
GDALTransformerFunc  pfnTransform,
void *  pTransformArg,
GDALProgressFunc  pfnProgress,
void *  pProgressArg,
char **  papszWarpOptions 
)

Perform simple image warp.

Copies an image from a source dataset to a destination dataset applying an application defined transformation. This algorithm is called simple because it lacks many options such as resampling kernels (other than nearest neighbour), support for data types other than 8bit, and the ability to warp images without holding the entire source and destination image in memory.

The following option(s) may be passed in papszWarpOptions.

  • "INIT=v[,v...]": This option indicates that the output dataset should be initialized to the indicated value in any area valid data is not written. Distinct values may be listed for each band separated by columns.
Parameters:
hSrcDS the source image dataset.
hDstDS the destination image dataset.
nBandCount the number of bands to be warped. If zero, all bands will be processed.
panBandList the list of bands to translate.
pfnTransform the transformation function to call. See GDALTransformerFunc().
pTransformArg the callback handle to pass to pfnTransform.
pfnProgress the function used to report progress. See GDALProgressFunc().
pProgressArg the callback handle to pass to pfnProgress.
papszWarpOptions additional options controlling the warp.
Returns:
TRUE if the operation completes, or FALSE if an error occurs.

References GDALGetRasterBand(), GDALGetRasterCount(), GDALGetRasterXSize(), GDALGetRasterYSize(), GDALRasterIO(), GDALSimpleImageWarp(), GDT_Byte, GF_Read, and GF_Write.

Referenced by GDALSimpleImageWarp().

CPLErr GDALSuggestedWarpOutput ( GDALDatasetH  hSrcDS,
GDALTransformerFunc  pfnTransformer,
void *  pTransformArg,
double *  padfGeoTransformOut,
int *  pnPixels,
int *  pnLines 
)

Suggest output file size.

This function is used to suggest the size, and georeferenced extents appropriate given the indicated transformation and input file. It walks the edges of the input file (approximately 20 sample points along each edge) transforming into output coordinates in order to get an extents box.

Then a resolution is computed with the intent that the length of the distance from the top left corner of the output imagery to the bottom right corner would represent the same number of pixels as in the source image. Note that if the image is somewhat rotated the diagonal taken isnt of the whole output bounding rectangle, but instead of the locations where the top/left and bottom/right corners transform. The output pixel size is always square. This is intended to approximately preserve the resolution of the input data in the output file.

The values returned in padfGeoTransformOut, pnPixels and pnLines are the suggested number of pixels and lines for the output file, and the geotransform relating those pixels to the output georeferenced coordinates.

The trickiest part of using the function is ensuring that the transformer created is from source file pixel/line coordinates to output file georeferenced coordinates. This can be accomplished with GDALCreateGenImProjTransformer() by passing a NULL for the hDstDS.

Parameters:
hSrcDS the input image (it is assumed the whole input images is being transformed).
pfnTransformer the transformer function.
pTransformArg the callback data for the transformer function.
padfGeoTransformOut the array of six doubles in which the suggested geotransform is returned.
pnPixels int in which the suggest pixel width of output is returned.
pnLines int in which the suggest pixel height of output is returned.
Returns:
CE_None if successful or CE_Failure otherwise.

References GDALSuggestedWarpOutput(), and GDALSuggestedWarpOutput2().

Referenced by GDALAutoCreateWarpedVRT(), and GDALSuggestedWarpOutput().

CPLErr GDALSuggestedWarpOutput2 ( GDALDatasetH  hSrcDS,
GDALTransformerFunc  pfnTransformer,
void *  pTransformArg,
double *  padfGeoTransformOut,
int *  pnPixels,
int *  pnLines,
double *  padfExtent,
int  nOptions 
)

Suggest output file size.

This function is used to suggest the size, and georeferenced extents appropriate given the indicated transformation and input file. It walks the edges of the input file (approximately 20 sample points along each edge) transforming into output coordinates in order to get an extents box.

Then a resolution is computed with the intent that the length of the distance from the top left corner of the output imagery to the bottom right corner would represent the same number of pixels as in the source image. Note that if the image is somewhat rotated the diagonal taken isnt of the whole output bounding rectangle, but instead of the locations where the top/left and bottom/right corners transform. The output pixel size is always square. This is intended to approximately preserve the resolution of the input data in the output file.

The values returned in padfGeoTransformOut, pnPixels and pnLines are the suggested number of pixels and lines for the output file, and the geotransform relating those pixels to the output georeferenced coordinates.

The trickiest part of using the function is ensuring that the transformer created is from source file pixel/line coordinates to output file georeferenced coordinates. This can be accomplished with GDALCreateGenImProjTransformer() by passing a NULL for the hDstDS.

Parameters:
hSrcDS the input image (it is assumed the whole input images is being transformed).
pfnTransformer the transformer function.
pTransformArg the callback data for the transformer function.
padfGeoTransformOut the array of six doubles in which the suggested geotransform is returned.
pnPixels int in which the suggest pixel width of output is returned.
pnLines int in which the suggest pixel height of output is returned.
padfExtent Four entry array to return extents as (xmin, ymin, xmax, ymax).
nOptions Options, currently always zero.
Returns:
CE_None if successful or CE_Failure otherwise.

References GDALGetRasterXSize(), GDALGetRasterYSize(), and GDALSuggestedWarpOutput2().

Referenced by GDALSuggestedWarpOutput(), and GDALSuggestedWarpOutput2().

int GDALTPSTransform ( void *  pTransformArg,
int  bDstToSrc,
int  nPointCount,
double *  x,
double *  y,
double *  z,
int *  panSuccess 
)

Transforms point based on GCP derived polynomial model.

This function matches the GDALTransformerFunc signature, and can be used to transform one or more points from pixel/line coordinates to georeferenced coordinates (SrcToDst) or vice versa (DstToSrc).

Parameters:
pTransformArg return value from GDALCreateTPSTransformer().
bDstToSrc TRUE if transformation is from the destination (georeferenced) coordinates to pixel/line or FALSE when transforming from pixel/line to georeferenced coordinates.
nPointCount the number of values in the x, y and z arrays.
x array containing the X values to be transformed.
y array containing the Y values to be transformed.
z array containing the Z values to be transformed.
panSuccess array in which a flag indicating success (TRUE) or failure (FALSE) of the transformation are placed.
Returns:
TRUE.

References GDALTPSTransform().

Referenced by GDALCreateTPSTransformer(), GDALGenImgProjTransform(), and GDALTPSTransform().


Generated for GDAL by doxygen 1.6.2-20100208.