gdal_alg.h File Reference

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

Go to the source code of this file.

Classes

struct  GDALTransformerInfo
struct  OGRContourWriterInfo

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

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)
void * GDALCreateGenImgProjTransformer (GDALDatasetH hSrcDS, const char *pszSrcWKT, GDALDatasetH hDstDS, const char *pszDstWKT, int bGCPUseOK, double dfGCPErrorThreshold, int nOrder)
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)
void GDALDestroyRPCTransformer (void *pTransformArg)
int GDALRPCTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
void * GDALCreateApproxTransformer (GDALTransformerFunc pfnRawTransformer, void *pRawTransformerArg, double dfMaxError)
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)
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)


Detailed Description

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

Typedef Documentation

int GDALTransformerFunc
 

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.


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.

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.

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.

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.

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

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.

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.
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.
dfGCPErrorThreshold the maximum error allowed for the GCP model to be considered valid. Exact semantics not yet defined.
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().

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.

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.

void GDALDestroyApproxTransformer void *  pCBData  ) 
 

Cleanup approximate transformer.

Deallocates the resources allocated by GDALCreateApproxTransformer().

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

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

void GDALDestroyGenImgProjTransformer void *  hTransformArg  ) 
 

GenImgProjTransformer deallocator.

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

Parameters:
hTransformArg the handle to deallocate.

void GDALDestroyReprojectionTransformer void *  pTransformAlg  ) 
 

Destroy reprojection transformation.

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

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

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.

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.

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.

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.

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.

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

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.

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.

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.


Generated on Mon Jan 9 18:03:35 2006 for GDAL by  doxygen 1.4.6