GDAL
|
GDAL warper related entry points and definitions. More...
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 | |
GDALWarpOptions * | GDALCreateWarpOptions (void) |
Create a warp options structure. More... | |
void | GDALDestroyWarpOptions (GDALWarpOptions *) |
Destroy a warp options structure. More... | |
GDALWarpOptions * | GDALCloneWarpOptions (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) |
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.
#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.
enum GDALResampleAlg |
Warp Resampling Algorithm
enum GWKAverageOrModeAlg |
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.
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, GRA_CubicSpline, GRA_Lanczos, GRA_Average or GRA_Mode. Controls the sampling method used. |
dfMaxError | Maximum error measured in input pixels that is allowed in approximating the transformation (0.0 for exact calculations). |
psOptionsIn | Additional warp options, normally NULL. |
CPLErr GDALChunkAndWarpImage | ( | GDALWarpOperationH | hOperation, |
int | nDstXOff, | ||
int | nDstYOff, | ||
int | nDstXSize, | ||
int | nDstYSize | ||
) |
CPLErr GDALChunkAndWarpMulti | ( | GDALWarpOperationH | hOperation, |
int | nDstXOff, | ||
int | nDstYOff, | ||
int | nDstXSize, | ||
int | nDstYSize | ||
) |
GDALWarpOptions* GDALCloneWarpOptions | ( | const GDALWarpOptions * | psSrcOptions | ) |
Clone a warp options structure.
Must be deallocated with GDALDestroyWarpOptions()
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().
hSrcDS | The source dataset. |
nPixels | Width of the virtual warped dataset to create |
nLines | Height of the virtual warped dataset to create |
padfGeoTransform | Geotransform matrix of the virtual warped dataset to create |
psOptions | Warp options. Must be different from NULL. |
GDALWarpOperationH GDALCreateWarpOperation | ( | const GDALWarpOptions * | psNewOptions | ) |
GDALWarpOptions* GDALCreateWarpOptions | ( | void | ) |
Create a warp options structure.
Must be deallocated with GDALDestroyWarpOptions()
void GDALDestroyWarpOperation | ( | GDALWarpOperationH | hOperation | ) |
void GDALDestroyWarpOptions | ( | GDALWarpOptions * | psOptions | ) |
Destroy a warp options structure.
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().
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. |
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.
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. |
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.
psOptionsIn | options to initialize. |
nBandCount | bands to initialize for. |
void GDALWarpInitDstNoDataImag | ( | GDALWarpOptions * | psOptionsIn, |
double | dNoDataImag | ||
) |
Initialize padfDstNoDataImag with specified value.
psOptionsIn | options to initialize. |
dNoDataImag | value to initialize to. |
void GDALWarpInitDstNoDataReal | ( | GDALWarpOptions * | psOptionsIn, |
double | dNoDataReal | ||
) |
Initialize padfDstNoDataReal with specified value.
psOptionsIn | options to initialize. |
dNoDataReal | value to initialize to. |
void GDALWarpInitNoDataReal | ( | GDALWarpOptions * | psOptionsIn, |
double | dNoDataReal | ||
) |
Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value.
psOptionsIn | options to initialize. |
dNoDataReal | value to initialize to. |
void GDALWarpInitSrcNoDataImag | ( | GDALWarpOptions * | psOptionsIn, |
double | dNoDataImag | ||
) |
Initialize padfSrcNoDataImag with specified value.
psOptionsIn | options to initialize. |
dNoDataImag | value to initialize to. |
void GDALWarpInitSrcNoDataReal | ( | GDALWarpOptions * | psOptionsIn, |
double | dNoDataReal | ||
) |
Initialize padfSrcNoDataReal with specified value.
psOptionsIn | options to initialize. |
dNoDataReal | value to initialize to. |
CPLErr GDALWarpRegion | ( | GDALWarpOperationH | hOperation, |
int | nDstXOff, | ||
int | nDstYOff, | ||
int | nDstXSize, | ||
int | nDstYSize, | ||
int | nSrcXOff, | ||
int | nSrcYOff, | ||
int | nSrcXSize, | ||
int | nSrcYSize | ||
) |
CPLErr GDALWarpRegionToBuffer | ( | GDALWarpOperationH | hOperation, |
int | nDstXOff, | ||
int | nDstYOff, | ||
int | nDstXSize, | ||
int | nDstYSize, | ||
void * | pDataBuf, | ||
GDALDataType | eBufDataType, | ||
int | nSrcXOff, | ||
int | nSrcYOff, | ||
int | nSrcXSize, | ||
int | nSrcYSize | ||
) |
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.
psOptions | options to initialize. |