GDAL
Classes | Macros | Typedefs | Enumerations | Functions
gdalwarper.h File Reference

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

#include "gdal_alg.h"
#include "cpl_minixml.h"
#include "cpl_multiproc.h"

Go to the source code of this file.

Classes

struct  GDALWarpOptions
 Warp control options for use with GDALWarpOperation::Initialize() More...
 
class  GDALWarpKernel
 This class represents the lowest level of abstraction of warping. More...
 
class  GDALWarpOperation
 High level image warping class. More...
 

Macros

#define WARP_EXTRA_ELTS   1
 This is the number of dummy pixels that must be reserved in source arrays in order to satisfy assumptions made in GWKResample(), and more specifically by GWKGetPixelRow() that always read a even number of pixels. More...
 

Typedefs

typedef void * GDALWarpOperationH
 Opaque type representing a GDALWarpOperation object.
 

Enumerations

enum  GDALResampleAlg {
  GRA_NearestNeighbour =0, GRA_Bilinear =1, GRA_Cubic =2, GRA_CubicSpline =3,
  GRA_Lanczos =4, GRA_Average =5, GRA_Mode =6, GRA_Max =8,
  GRA_Min =9, GRA_Med =10, GRA_Q1 =11, GRA_Q3 =12
}
 
enum  GWKAverageOrModeAlg {
  GWKAOM_Average =1, GWKAOM_Fmode =2, GWKAOM_Imode =3, GWKAOM_Max =4,
  GWKAOM_Min =5, GWKAOM_Quant =6
}
 

Functions

GDALWarpOptionsGDALCreateWarpOptions (void)
 Create a warp options structure. More...
 
void GDALDestroyWarpOptions (GDALWarpOptions *)
 Destroy a warp options structure. More...
 
GDALWarpOptionsGDALCloneWarpOptions (const GDALWarpOptions *)
 Clone a warp options structure. More...
 
void GDALWarpInitDstNoDataReal (GDALWarpOptions *, double dNoDataReal)
 Initialize padfDstNoDataReal with specified value. More...
 
void GDALWarpInitSrcNoDataReal (GDALWarpOptions *, double dNoDataReal)
 Initialize padfSrcNoDataReal with specified value. More...
 
void GDALWarpInitNoDataReal (GDALWarpOptions *, double dNoDataReal)
 Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value. More...
 
void GDALWarpInitDstNoDataImag (GDALWarpOptions *, double dNoDataImag)
 Initialize padfDstNoDataImag with specified value. More...
 
void GDALWarpInitSrcNoDataImag (GDALWarpOptions *, double dNoDataImag)
 Initialize padfSrcNoDataImag with specified value. More...
 
void GDALWarpResolveWorkingDataType (GDALWarpOptions *)
 If the working data type is unknown, this method will determine a valid working data type to support the data in the src and dest data sets and any noData values. More...
 
void GDALWarpInitDefaultBandMapping (GDALWarpOptions *, int nBandCount)
 Init src and dst band mappings such that Bands[i] = i+1 for nBandCount Does nothing if psOptionsIn->nBandCount is non-zero. More...
 
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. More...
 
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)
 Reproject an image and create the target reprojected image.
 
GDALDatasetH GDALAutoCreateWarpedVRT (GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfMaxError, const GDALWarpOptions *psOptions)
 Create virtual warped dataset automatically. More...
 
GDALDatasetH GDALCreateWarpedVRT (GDALDatasetH hSrcDS, int nPixels, int nLines, double *padfGeoTransform, GDALWarpOptions *psOptions)
 Create virtual warped dataset. More...
 
CPLErr GDALInitializeWarpedVRT (GDALDatasetH hDS, GDALWarpOptions *psWO)
 Set warp info on virtual warped dataset. More...
 
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.

Macro Definition Documentation

◆ WARP_EXTRA_ELTS

#define WARP_EXTRA_ELTS   1

This is the number of dummy pixels that must be reserved in source arrays in order to satisfy assumptions made in GWKResample(), and more specifically by GWKGetPixelRow() that always read a even number of pixels.

So if we are in the situation to read the last pixel of the source array, we need 1 extra dummy pixel to avoid reading out of bounds.

Enumeration Type Documentation

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

GRA_Average 

Average (computes the average of all non-NODATA contributing pixels)

GRA_Mode 

Mode (selects the value which appears most often of all the sampled points)

GRA_Max 

Max (selects maximum of all non-NODATA contributing pixels)

GRA_Min 

Min (selects minimum of all non-NODATA contributing pixels)

GRA_Med 

Med (selects median of all non-NODATA contributing pixels)

GRA_Q1 

Q1 (selects first quartile of all non-NODATA contributing pixels)

GRA_Q3 

Q3 (selects third quartile of all non-NODATA contributing pixels)

◆ GWKAverageOrModeAlg

GWKAverageOrMode Algorithm

Enumerator
GWKAOM_Average 

Average

GWKAOM_Fmode 

Mode

GWKAOM_Imode 

Mode of GDT_Byte, GDT_UInt16, or GDT_Int16

GWKAOM_Max 

Maximum

GWKAOM_Min 

Minimum

GWKAOM_Quant 

Quantile

Function Documentation

◆ GDALAutoCreateWarpedVRT()

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

If you want to create an alpha band if the source dataset has none, set psOptionsIn->nDstAlphaBand = GDALGetRasterCount(hSrcDS) + 1.

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
hSrcDSThe source dataset.
pszSrcWKTThe coordinate system of the source image. If NULL, it will be read from the source image.
pszDstWKTThe coordinate system to convert to. If NULL no change of coordinate system will take place.
eResampleAlgOne of GRA_NearestNeighbour, GRA_Bilinear, GRA_Cubic, GRA_CubicSpline, GRA_Lanczos, GRA_Average or GRA_Mode. Controls the sampling method used.
dfMaxErrorMaximum error measured in input pixels that is allowed in approximating the transformation (0.0 for exact calculations).
psOptionsInAdditional warp options, normally NULL.
Returns
NULL on failure, or a new virtual dataset handle on success.

◆ GDALChunkAndWarpImage()

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

◆ GDALChunkAndWarpMulti()

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

◆ GDALCloneWarpOptions()

GDALWarpOptions* GDALCloneWarpOptions ( const GDALWarpOptions psSrcOptions)

Clone a warp options structure.

Must be deallocated with GDALDestroyWarpOptions()

◆ GDALCreateWarpedVRT()

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.

If you want to create an alpha band if the source dataset has none, set psOptions->nDstAlphaBand = GDALGetRasterCount(hSrcDS) + 1.

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
hSrcDSThe source dataset.
nPixelsWidth of the virtual warped dataset to create
nLinesHeight of the virtual warped dataset to create
padfGeoTransformGeotransform matrix of the virtual warped dataset to create
psOptionsWarp options. Must be different from NULL.
Returns
NULL on failure, or a new virtual dataset handle on success.

◆ GDALCreateWarpOperation()

GDALWarpOperationH GDALCreateWarpOperation ( const GDALWarpOptions psNewOptions)

◆ GDALCreateWarpOptions()

GDALWarpOptions* GDALCreateWarpOptions ( void  )

Create a warp options structure.

Must be deallocated with GDALDestroyWarpOptions()

◆ GDALDestroyWarpOperation()

void GDALDestroyWarpOperation ( GDALWarpOperationH  hOperation)
See also
GDALWarpOperation::~GDALWarpOperation()

◆ GDALDestroyWarpOptions()

void GDALDestroyWarpOptions ( GDALWarpOptions psOptions)

Destroy a warp options structure.

◆ GDALInitializeWarpedVRT()

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
hDSdataset previously created with the VRT driver, and a SUBCLASS of "VRTWarpedDataset".
psWOthe 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.

◆ GDALReprojectImage()

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.

No metadata, projection info, or color tables are transferred to the output file.

Starting with GDAL 2.0, nodata values set on destination dataset are taken into account.

Parameters
hSrcDSthe source image file.
pszSrcWKTthe source projection. If NULL the source projection is read from from hSrcDS.
hDstDSthe destination image file.
pszDstWKTthe destination projection. If NULL the destination projection will be read from hDstDS.
eResampleAlgthe type of resampling to use.
dfWarpMemoryLimitthe 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.
dfMaxErrormaximum error measured in input pixels that is allowed in approximating the transformation (0.0 for exact calculations).
pfnProgressa GDALProgressFunc() compatible callback function for reporting progress or NULL.
pProgressArgargument to be passed to pfnProgress. May be NULL.
psOptionswarp options, normally NULL.
Returns
CE_None on success or CE_Failure if something goes wrong.

◆ GDALWarpInitDefaultBandMapping()

void GDALWarpInitDefaultBandMapping ( GDALWarpOptions psOptionsIn,
int  nBandCount 
)

Init src and dst band mappings such that Bands[i] = i+1 for nBandCount Does nothing if psOptionsIn->nBandCount is non-zero.

Parameters
psOptionsInoptions to initialize.
nBandCountbands to initialize for.

◆ GDALWarpInitDstNoDataImag()

void GDALWarpInitDstNoDataImag ( GDALWarpOptions psOptionsIn,
double  dNoDataImag 
)

Initialize padfDstNoDataImag with specified value.

Parameters
psOptionsInoptions to initialize.
dNoDataImagvalue to initialize to.

◆ GDALWarpInitDstNoDataReal()

void GDALWarpInitDstNoDataReal ( GDALWarpOptions psOptionsIn,
double  dNoDataReal 
)

Initialize padfDstNoDataReal with specified value.

Parameters
psOptionsInoptions to initialize.
dNoDataRealvalue to initialize to.

◆ GDALWarpInitNoDataReal()

void GDALWarpInitNoDataReal ( GDALWarpOptions psOptionsIn,
double  dNoDataReal 
)

Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value.

Parameters
psOptionsInoptions to initialize.
dNoDataRealvalue to initialize to.

◆ GDALWarpInitSrcNoDataImag()

void GDALWarpInitSrcNoDataImag ( GDALWarpOptions psOptionsIn,
double  dNoDataImag 
)

Initialize padfSrcNoDataImag with specified value.

Parameters
psOptionsInoptions to initialize.
dNoDataImagvalue to initialize to.

◆ GDALWarpInitSrcNoDataReal()

void GDALWarpInitSrcNoDataReal ( GDALWarpOptions psOptionsIn,
double  dNoDataReal 
)

Initialize padfSrcNoDataReal with specified value.

Parameters
psOptionsInoptions to initialize.
dNoDataRealvalue to initialize to.

◆ GDALWarpRegion()

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

◆ GDALWarpRegionToBuffer()

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

◆ GDALWarpResolveWorkingDataType()

void GDALWarpResolveWorkingDataType ( GDALWarpOptions psOptions)

If the working data type is unknown, this method will determine a valid working data type to support the data in the src and dest data sets and any noData values.

Parameters
psOptionsoptions to initialize.

Generated for GDAL by doxygen 1.8.13.