Main Page Class Hierarchy Compound List File List Compound Members File Members Related Pages

# gdal.h File Reference

Public (C callable) GDAL entry points. More...

`#include "cpl_port.h"`
`#include "cpl_error.h"`

Go to the source code of this file.

## Compounds
|  | struct | GDAL_GCP
|  | struct | GDALColorEntry
## Typedefs
|  | typedef void* | GDALMajorObjectH
|  | typedef void* | GDALDatasetH
|  | typedef void* | GDALRasterBandH
|  | typedef void* | GDALDriverH
|  | typedef void* | GDALProjDefH
|  | typedef void* | GDALColorTableH
|  | typedef int (* | GDALProgressFunc )(double,const char *, void *)
## Enumerations
|  | enum | GDALDataType { GDT_Unknown = 0, GDT_Byte = 1, GDT_UInt16 = 2, GDT_Int16 = 3, GDT_UInt32 = 4, GDT_Int32 = 5, GDT_Float32 = 6, GDT_Float64 = 7, GDT_CInt16 = 8, GDT_CInt32 = 9, GDT_CFloat32 = 10, GDT_CFloat64 = 11, GDT_TypeCount = 12 }
|  | enum | GDALAccess { GA_ReadOnly = 0, GA_Update = 1 }
|  | enum | GDALRWFlag { GF_Read = 0, GF_Write = 1 }
|  | enum | GDALColorInterp { GCI_Undefined = 0, GCI_GrayIndex = 1, GCI_PaletteIndex = 2, GCI_RedBand = 3, GCI_GreenBand = 4, GCI_BlueBand = 5, GCI_AlphaBand = 6, GCI_HueBand = 7, GCI_SaturationBand = 8, GCI_LightnessBand = 9, GCI_CyanBand = 10, GCI_MagentaBand = 11, GCI_YellowBand = 12, GCI_BlackBand = 13 }
|  | enum | GDALPaletteInterp { GPI_Gray = 0, GPI_RGB = 1, GPI_CMYK = 2, GPI_HLS = 3 }
## Functions
|  | int CPL_DLL | GDALGetDataTypeSize ( GDALDataType )
|  | int CPL_DLL | GDALDataTypeIsComplex ( GDALDataType )
|  | const char CPL_DLL* | GDALGetDataTypeName ( GDALDataType )
|  | const char CPL_DLL* | GDALGetColorInterpretationName ( GDALColorInterp )
|  | const char CPL_DLL* | GDALGetPaletteInterpretationName ( GDALPaletteInterp )
|  | int CPL_DLL | GDALDummyProgress ( double, const char *, void *)
|  | void CPL_DLL | GDALAllRegister ( void )
|  |  | Register all known configured GDAL drivers. More...

|  | GDALDatasetH CPL_DLL | GDALCreate ( GDALDriverH hDriver, const char *, int, int, int, GDALDataType, char ** )
|  | GDALDatasetH CPL_DLL | GDALCreateCopy ( GDALDriverH, const char *, GDALDatasetH, int, char **, GDALProgressFunc, void * )
|  | GDALDatasetH CPL_DLL | GDALOpen ( const char *, GDALAccess )
|  |  | Open a raster file as a GDALDataset. More...

|  | GDALDriverH CPL_DLL | GDALGetDriverByName ( const char * )
|  | int CPL_DLL | GDALGetDriverCount ()
|  | GDALDriverH CPL_DLL | GDALGetDriver ( int )
|  | int CPL_DLL | GDALRegisterDriver ( GDALDriverH )
|  | void CPL_DLL | GDALDeregisterDriver ( GDALDriverH )
|  | CPLErr CPL_DLL | GDALDeleteDataset ( GDALDriverH, const char * )
|  | const char CPL_DLL* | GDALGetDriverShortName ( GDALDriverH )
|  | const char CPL_DLL* | GDALGetDriverLongName ( GDALDriverH )
|  | const char CPL_DLL* | GDALGetDriverHelpTopic ( GDALDriverH )
|  | void CPL_DLL | GDALInitGCPs ( int, GDAL_GCP * )
|  | void CPL_DLL | GDALDeinitGCPs ( int, GDAL_GCP * )
|  | GDAL_GCP CPL_DLL* | GDALDuplicateGCPs ( int, const GDAL_GCP * )
|  | char CPL_DLL** | GDALGetMetadata ( GDALMajorObjectH, const char * )
|  | CPLErr CPL_DLL | GDALSetMetadata ( GDALMajorObjectH, char **, const char * )
|  | char CPL_DLL** | GDALGetMetadataItem ( GDALMajorObjectH, const char * )
|  | CPLErr CPL_DLL | GDALSetMetadataItem ( GDALMajorObjectH, const char *, const char *, const char * )
|  | GDALDriverH CPL_DLL | GDALGetDatasetDriver ( GDALDatasetH )
|  | void CPL_DLL | GDALClose ( GDALDatasetH )
|  | int CPL_DLL | GDALGetRasterXSize ( GDALDatasetH )
|  | int CPL_DLL | GDALGetRasterYSize ( GDALDatasetH )
|  | int CPL_DLL | GDALGetRasterCount ( GDALDatasetH )
|  | GDALRasterBandH CPL_DLL | GDALGetRasterBand ( GDALDatasetH, int )
|  | const char CPL_DLL* | GDALGetProjectionRef ( GDALDatasetH )
|  | CPLErr CPL_DLL | GDALSetProjection ( GDALDatasetH, const char * )
|  | CPLErr CPL_DLL | GDALGetGeoTransform ( GDALDatasetH, double * )
|  | CPLErr CPL_DLL | GDALSetGeoTransform ( GDALDatasetH, double * )
|  | int CPL_DLL | GDALGetGCPCount ( GDALDatasetH )
|  | const char CPL_DLL* | GDALGetGCPProjection ( GDALDatasetH )
|  | const GDAL_GCP CPL_DLL* | GDALGetGCPs ( GDALDatasetH )
|  | void CPL_DLL* | GDALGetInternalHandle ( GDALDatasetH, const char * )
|  | int CPL_DLL | GDALReferenceDataset ( GDALDatasetH )
|  | int CPL_DLL | GDALDereferenceDataset ( GDALDatasetH )
|  | GDALDataType CPL_DLL | GDALGetRasterDataType ( GDALRasterBandH )
|  | void CPL_DLL | GDALGetBlockSize ( GDALRasterBandH, int * pnXSize, int * pnYSize )
|  | CPLErr CPL_DLL | GDALRasterIO ( GDALRasterBandH hRBand, GDALRWFlag eRWFlag, int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize, void * pBuffer, int nBXSize, int nBYSize, GDALDataType eBDataType, int nPixelSpace, int nLineSpace )
|  | CPLErr CPL_DLL | GDALReadBlock ( GDALRasterBandH, int, int, void * )
|  | CPLErr CPL_DLL | GDALWriteBlock ( GDALRasterBandH, int, int, void * )
|  | int CPL_DLL | GDALGetRasterBandXSize ( GDALRasterBandH )
|  | int CPL_DLL | GDALGetRasterBandYSize ( GDALRasterBandH )
|  | char CPL_DLL** | GDALGetRasterMetadata ( GDALRasterBandH )
|  | GDALColorInterp CPL_DLL | GDALGetRasterColorInterpretation ( GDALRasterBandH )
|  | GDALColorTableH CPL_DLL | GDALGetRasterColorTable ( GDALRasterBandH )
|  | int CPL_DLL | GDALGetOverviewCount ( GDALRasterBandH )
|  | GDALRasterBandH CPL_DLL | GDALGetOverview ( GDALRasterBandH, int )
|  | double CPL_DLL | GDALGetRasterNoDataValue ( GDALRasterBandH, int *pbSuccess )
|  | double CPL_DLL | GDALGetRasterMinimum ( GDALRasterBandH, int *pbSuccess )
|  | double CPL_DLL | GDALGetRasterMaximum ( GDALRasterBandH, int *pbSuccess )
|  | void CPL_DLL | GDALComputeRasterMinMax ( GDALRasterBandH hBand, int bApproxOK, double adfMinMax[2] )
|  |  | Compute the min/max values for a band. More...

|  | CPLErr CPL_DLL | GDALFlushRasterCache ( GDALRasterBandH hBand )
|  | CPLErr CPL_DLL | GDALGetRasterHistogram ( GDALRasterBandH hBand, double dfMin, double dfMax, int nBuckets, int *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc pfnProgress, void * pProgressData )
|  | int CPL_DLL | GDALGetRandomRasterSample ( GDALRasterBandH, int, float * )
|  | void CPL_DLL | GDALSwapWords ( void *pData, int nWordSize, int nWordCount, int nWordSkip )
|  | void CPL_DLL | GDALCopyWords ( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset, void * pDstData, GDALDataType eDstType, int nDstPixelOffset, int nWordCount )
|  | GDALColorTableH CPL_DLL | GDALCreateColorTable ( GDALPaletteInterp )
|  | void CPL_DLL | GDALDestroyColorTable ( GDALColorTableH )
|  | GDALColorTableH CPL_DLL | GDALCloneColorTable ( GDALColorTableH )
|  | GDALPaletteInterp CPL_DLL | GDALGetPaletteInterpretation ( GDALColorTableH )
|  | int CPL_DLL | GDALGetColorEntryCount ( GDALColorTableH )
|  | const GDALColorEntry CPL_DLL* | GDALGetColorEntry ( GDALColorTableH, int )
|  | int CPL_DLL | GDALGetColorEntryAsRGB ( GDALColorTableH, int, GDALColorEntry *)
|  | void CPL_DLL | GDALSetColorEntry ( GDALColorTableH, int, const GDALColorEntry * )
|  | GDALProjDefH CPL_DLL | GDALCreateProjDef ( const char * )
|  | CPLErr CPL_DLL | GDALReprojectToLongLat ( GDALProjDefH, double *, double * )
|  | CPLErr CPL_DLL | GDALReprojectFromLongLat ( GDALProjDefH, double *, double * )
|  | void CPL_DLL | GDALDestroyProjDef ( GDALProjDefH )
|  | const char CPL_DLL* | GDALDecToDMS ( double, const char *, int )
|  | void CPL_DLL | GDALSetCacheMax ( int nBytes )
|  | int CPL_DLL | GDALGetCacheMax ()
|  | int CPL_DLL | GDALGetCacheUsed ()
|  | int CPL_DLL | GDALFlushCacheBlock ()

## Detailed Description

Public (C callable) GDAL entry points.

## Enumeration Type Documentation

enum GDALAccess

Flag indicating read/write, or read-only access to data.

Enumeration values:

  GA_ReadOnly | Read only (no update) access
  GA_Update | Read/write access.

enum GDALColorInterp

Types of color interpretation for raster bands.

enum GDALDataType

Pixel data types

Enumeration values:

  GDT_Byte | Eight bit unsigned integer
  GDT_UInt16 | Sixteen bit unsigned integer
  GDT_Int16 | Sixteen bit signed integer
  GDT_UInt32 | Thirty two bit unsigned integer
  GDT_Int32 | Thirty two bit signed integer
  GDT_Float32 | Thirty two bit floating point
  GDT_Float64 | Sixty four bit floating point
  GDT_CInt16 | Complex Int16
  GDT_CInt32 | Complex Int32
  GDT_CFloat32 | Complex Float32
  GDT_CFloat64 | Complex Float64

enum GDALPaletteInterp

Types of color interpretations for a GDALColorTable.

## Function Documentation

CPL_C_END void GDALAllRegister (void)

Register all known configured GDAL drivers.

This function will drive any of the following that are configured into GDAL. Possible others as well that haven't been updated in this documentation:

- GeoTIFF (GTiff)
- Geosoft GXF (GXF)
- Erdas Imagine (HFA)
- CEOS (CEOS)
- ELAS (ELAS)
- Arc/Info Binary Grid (AIGrid)
- SDTS Raster DEM (SDTS)
- OGDI (OGDI)
- ESRI Labelled BIL (EHdr)
- PCI .aux Labelled Raw Raster (PAux)

void GDALComputeRasterMinMax (GDALRasterBandH hBand, int bApproxOK, double adfMinMax[2])

Compute the min/max values for a band.

If approximate is OK, then the band's GetMinimum()/GetMaximum() will be trusted. If it doesn't work, a subsample of blocks will be read to get an approximate min/max. If the band has a nodata value it will be excluded from the minimum and maximum.

If bApprox is FALSE, then all pixels will be read and used to compute an exact range.

Parameters:

  hBand | the band to copmute the range for.
  bApproxOK | TRUE if an approximate (faster) answer is OK, otherwise FALSE.
  adfMinMax | the array in which the minimum (adfMinMax[0]) and the maximum (adfMinMax[1]) are returned.

const char * GDALGetColorInterpretationName (GDALColorInterp eInterp)

Translate a GDALColorInterp into a user displayable string.

const char * GDALGetPaletteInterpretationName (GDALPaletteInterp eInterp)

Translate a GDALPaletteInterp into a user displayable string.

GDALDatasetH GDALOpen (const char * pszFilename, GDALAccess eAccess)

Open a raster file as a GDALDataset.

Parameters:

  pszFilename | the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset.

Parameters:

  eAccess | the desired access, either GA_Update or GA_ReadOnly. Many drivers support only read only access.

Returns:
  A GDALDatasetH handle or NULL on failure. For C++ applications this handle can be cast to a GDALDataset *.