- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# gdalwarper.h File Reference

`#include "gdal_alg.h"`
`#include "cpl_minixml.h"`

Go to the source code of this file.

## Classes
struct | GDALWarpOptions
class | GDALWarpKernel
class | GDALWarpOperation
## Typedefs
typedef int(*) | GDALMaskFunc (void *pMaskFuncArg, int nBandCount, GDALDataType eType, int nXOff, int nYOff, int nXSize, int nYSize, GByte **papabyImageData, int bMaskIsFloat, void *pMask)
typedef void * | GDALWarpOperationH
## Enumerations
enum | GDALResampleAlg { GRA_NearestNeighbour = 0, GRA_Bilinear = 1, GRA_Cubic = 2, GRA_CubicSpline = 3, GRA_Lanczos = 4 }
## Functions
CPLErr | GDALWarpNoDataMasker (void *pMaskFuncArg, int nBandCount, GDALDataType eType, int nXOff, int nYOff, int nXSize, int nYSize, GByte **papabyImageData, int bMaskIsFloat, void *pValidityMask)
CPLErr | GDALWarpDstAlphaMasker (void *pMaskFuncArg, int nBandCount, GDALDataType eType, int nXOff, int nYOff, int nXSize, int nYSize, GByte **, int bMaskIsFloat, void *pValidityMask)
CPLErr | GDALWarpSrcAlphaMasker (void *pMaskFuncArg, int nBandCount, GDALDataType eType, int nXOff, int nYOff, int nXSize, int nYSize, GByte **, int bMaskIsFloat, void *pValidityMask)
CPLErr | GDALWarpCutlineMasker (void *pMaskFuncArg, int nBandCount, GDALDataType eType, int nXOff, int nYOff, int nXSize, int nYSize, GByte **, int bMaskIsFloat, void *pValidityMask)
GDALWarpOptions * | GDALCreateWarpOptions (void)
void | GDALDestroyWarpOptions (GDALWarpOptions *)
GDALWarpOptions * | GDALCloneWarpOptions (const GDALWarpOptions *)
CPLXMLNode * | GDALSerializeWarpOptions (const GDALWarpOptions *)
GDALWarpOptions * | GDALDeserializeWarpOptions (CPLXMLNode *)
CPLErr | GDALReprojectImage (GDALDatasetH hSrcDS, const char *pszSrcWKT, GDALDatasetH hDstDS, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfWarpMemoryLimit, double dfMaxError, GDALProgressFunc pfnProgress, void *pProgressArg, GDALWarpOptions *psOptions)
CPLErr | GDALCreateAndReprojectImage (GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstFilename, const char *pszDstWKT, GDALDriverH hDstDriver, char **papszCreateOptions, GDALResampleAlg eResampleAlg, double dfWarpMemoryLimit, double dfMaxError, GDALProgressFunc pfnProgress, void *pProgressArg, GDALWarpOptions *psOptions)
GDALDatasetH | GDALAutoCreateWarpedVRT (GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfMaxError, const GDALWarpOptions *psOptions)
GDALDatasetH | GDALCreateWarpedVRT (GDALDatasetH hSrcDS, int nPixels, int nLines, double *padfGeoTransform, GDALWarpOptions *psOptions)
CPLErr | GDALInitializeWarpedVRT (GDALDatasetH hDS, GDALWarpOptions *psWO)
GDALWarpOperationH | GDALCreateWarpOperation (const GDALWarpOptions *)
void | GDALDestroyWarpOperation (GDALWarpOperationH)
CPLErr | GDALChunkAndWarpImage (GDALWarpOperationH, int, int, int, int)
CPLErr | GDALChunkAndWarpMulti (GDALWarpOperationH, int, int, int, int)
CPLErr | GDALWarpRegion (GDALWarpOperationH, int, int, int, int, int, int, int, int)
CPLErr | GDALWarpRegionToBuffer (GDALWarpOperationH, int, int, int, int, void *, GDALDataType, int, int, int, int)

## Detailed Description

GDAL warper related entry points and definitions. Eventually it is expected that this file will be mostly private to the implementation, and the public C entry points will be available in gdal_alg.h.

## Enumeration Type Documentation

enum GDALResampleAlg

Warp Resampling Algorithm

Enumerator:

  GRA_NearestNeighbour | Nearest neighbour (select on one input pixel)
  GRA_Bilinear | Bilinear (2x2 kernel)
  GRA_Cubic | Cubic Convolution Approximation (4x4 kernel)
  GRA_CubicSpline | Cubic B-Spline Approximation (4x4 kernel)
  GRA_Lanczos | Lanczos windowed sinc interpolation (6x6 kernel)

## Function Documentation

GDALDatasetH GDALAutoCreateWarpedVRT | ( | GDALDatasetH | hSrcDS,
|  | const char * | pszSrcWKT,
|  | const char * | pszDstWKT,
|  | GDALResampleAlg | eResampleAlg,
|  | double | dfMaxError,
|  | const GDALWarpOptions * | psOptionsIn |
| ) |  |  |

Create virtual warped dataset automatically.

This function will create a warped virtual file representing the input image warped into the target coordinate system. A GenImgProj transformation is created to accomplish any required GCP/Geotransform warp and reprojection to the target coordinate system. The output virtual dataset will be "northup" in the target coordinate system. The GDALSuggestedWarpOutput() function is used to determine the bounds and resolution of the output virtual file which should be large enough to include all the input image

Note that the constructed GDALDatasetH will acquire one or more references to the passed in hSrcDS. Reference counting semantics on the source dataset should be honoured. That is, don't just GDALClose() it unless it was opened with GDALOpenShared().

The returned dataset will have no associated filename for itself. If you want to write the virtual dataset description to a file, use the GDALSetDescription() function (or SetDescription() method) on the dataset to assign a filename before it is closed.

Parameters:

  | hSrcDS | The source dataset.
  | pszSrcWKT | The coordinate system of the source image. If NULL, it will be read from the source image.
  | pszDstWKT | The coordinate system to convert to. If NULL no change of coordinate system will take place.
  | eResampleAlg | One of GRA_NearestNeighbour, GRA_Bilinear, GRA_Cubic or GRA_CubicSpline. Controls the sampling method used.
  | dfMaxError | Maximum error measured in input pixels that is allowed in approximating the transformation (0.0 for exact calculations).
  | psOptions | Additional warp options, normally NULL.

Returns:
  NULL on failure, or a new virtual dataset handle on success.

CPLErr GDALChunkAndWarpImage | ( | GDALWarpOperationH | hOperation,
|  | int | nDstXOff,
|  | int | nDstYOff,
|  | int | nDstXSize,
|  | int | nDstYSize |
| ) |  |  |

See also:
  GDALWarpOperation::ChunkAndWarpImage()

CPLErr GDALChunkAndWarpMulti | ( | GDALWarpOperationH | hOperation,
|  | int | nDstXOff,
|  | int | nDstYOff,
|  | int | nDstXSize,
|  | int | nDstYSize |
| ) |  |  |

See also:
  GDALWarpOperation::ChunkAndWarpMulti()

GDALDatasetH GDALCreateWarpedVRT | ( | GDALDatasetH | hSrcDS,
|  | int | nPixels,
|  | int | nLines,
|  | double * | padfGeoTransform,
|  | GDALWarpOptions * | psOptions |
| ) |  |  |

Create virtual warped dataset.

This function will create a warped virtual file representing the input image warped based on a provided transformation. Output bounds and resolution are provided explicitly.

Note that the constructed GDALDatasetH will acquire one or more references to the passed in hSrcDS. Reference counting semantics on the source dataset should be honoured. That is, don't just GDALClose() it unless it was opened with GDALOpenShared().

Parameters:

  | hSrcDS | The source dataset.
  | nOverviewLevels | The number of "power of 2" overview levels to be built. If zero, no overview levels will be managed.
  | psOptions | Additional warp options, normally NULL.

Returns:
  NULL on failure, or a new virtual dataset handle on success.

GDALWarpOperationH GDALCreateWarpOperation | ( | const GDALWarpOptions * | psNewOptions | ) |

See also:
  GDALWarpOperation::Initialize()

void GDALDestroyWarpOperation | ( | GDALWarpOperationH | hOperation | ) |

See also:
  GDALWarpOperation::~GDALWarpOperation()

CPLErr GDALInitializeWarpedVRT | ( | GDALDatasetH | hDS,
|  | GDALWarpOptions * | psWO |
| ) |  |  |

Set warp info on virtual warped dataset.

Initializes all the warping information for a virtual warped dataset.

This method is the same as the C++ method VRTWarpedDataset::Initialize().

Parameters:

  | hDS | dataset previously created with the VRT driver, and a SUBCLASS of "VRTWarpedDataset".
  | psWO | the warp options to apply. Note that ownership of the transformation information is taken over by the function though everything else remains the property of the caller.

Returns:
  CE_None on success or CE_Failure if an error occurs.

CPLErr GDALReprojectImage | ( | GDALDatasetH | hSrcDS,
|  | const char * | pszSrcWKT,
|  | GDALDatasetH | hDstDS,
|  | const char * | pszDstWKT,
|  | GDALResampleAlg | eResampleAlg,
|  | double | dfWarpMemoryLimit,
|  | double | dfMaxError,
|  | GDALProgressFunc | pfnProgress,
|  | void * | pProgressArg,
|  | GDALWarpOptions * | psOptions |
| ) |  |  |

Reproject image.

This is a convenience function utilizing the GDALWarpOperation class to reproject an image from a source to a destination. In particular, this function takes care of establishing the transformation function to implement the reprojection, and will default a variety of other warp options.

By default all bands are transferred, with no masking or nodata values in effect. No metadata, projection info, or color tables are transferred to the output file.

Parameters:

  | hSrcDS | the source image file.
  | pszSrcWKT | the source projection. If NULL the source projection is read from from hSrcDS.
  | hDstDS | the destination image file.
  | pszDstWKT | the destination projection. If NULL the destination projection will be read from hDstDS.
  | eResampleAlg | the type of resampling to use.
  | dfWarpMemoryLimit | the amount of memory (in bytes) that the warp API is allowed to use for caching. This is in addition to the memory already allocated to the GDAL caching (as per GDALSetCacheMax()). May be 0.0 to use default memory settings.
  | dfMaxError | maximum error measured in input pixels that is allowed in approximating the transformation (0.0 for exact calculations).
  | pfnProgress | a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  | pProgressArg | argument to be passed to pfnProgress. May be NULL.
  | psOptions | warp options, normally NULL.

Returns:
  CE_None on success or CE_Failure if something goes wrong.

CPLErr GDALWarpRegion | ( | GDALWarpOperationH | hOperation,
|  | int | nDstXOff,
|  | int | nDstYOff,
|  | int | nDstXSize,
|  | int | nDstYSize,
|  | int | nSrcXOff,
|  | int | nSrcYOff,
|  | int | nSrcXSize,
|  | int | nSrcYSize |
| ) |  |  |

See also:
  GDALWarpOperation::WarpRegion()

CPLErr GDALWarpRegionToBuffer | ( | GDALWarpOperationH | hOperation,
|  | int | nDstXOff,
|  | int | nDstYOff,
|  | int | nDstXSize,
|  | int | nDstYSize,
|  | void * | pDataBuf,
|  | GDALDataType | eBufDataType,
|  | int | nSrcXOff,
|  | int | nSrcYOff,
|  | int | nSrcXSize,
|  | int | nSrcYSize |
| ) |  |  |

See also:
  GDALWarpOperation::WarpRegionToBuffer()

Generated for GDAL by 1.5.1.