00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00031 00031 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131
00132
00133 #ifndef GDAL_H_INCLUDED
00134 #define GDAL_H_INCLUDED
00135
00142 #include "cpl_port.h"
00143 #include "cpl_error.h"
00144
00145
00146
00147
00148
00149 CPL_C_START
00150
00152 typedef enum {
00153 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,
00165 GDT_TypeCount = 12
00166 } GDALDataType;
00167
00168 int CPL_DLL GDALGetDataTypeSize( GDALDataType );
00169 int CPL_DLL GDALDataTypeIsComplex( GDALDataType );
00170 const char CPL_DLL *GDALGetDataTypeName( GDALDataType );
00171 GDALDataType CPL_DLL GDALDataTypeUnion( GDALDataType, GDALDataType );
00172
00174 typedef enum { GA_ReadOnly = 0, GA_Update = 1
00177 } GDALAccess;
00178
00180 typedef enum { GF_Read = 0, GF_Write = 1
00183 } GDALRWFlag;
00184
00186 typedef enum
00187 {
00188 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
00202 } GDALColorInterp;
00203
00205 const char CPL_DLL *GDALGetColorInterpretationName( GDALColorInterp );
00206
00208 typedef enum
00209 { GPI_Gray=0, GPI_RGB=1, GPI_CMYK=2, GPI_HLS=3
00214 } GDALPaletteInterp;
00215
00217 const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp );
00218
00219
00220
00221
00222
00223
00224 #define CPLE_WrongFormat 200
00225
00226
00227
00228
00229 typedef void *GDALMajorObjectH;
00230 typedef void *GDALDatasetH;
00231 typedef void *GDALRasterBandH;
00232 typedef void *GDALDriverH;
00233 typedef void *GDALProjDefH;
00234 typedef void *GDALColorTableH;
00235
00236
00237
00238
00241 typedef int (*GDALProgressFunc)(double,const char *, void *);
00242 int CPL_DLL GDALDummyProgress( double, const char *, void *);
00243 int CPL_DLL GDALTermProgress( double, const char *, void *);
00244 int CPL_DLL GDALScaledProgress( double, const char *, void *);
00245 void CPL_DLL *GDALCreateScaledProgress( double, double,
00246 GDALProgressFunc, void * );
00247 void CPL_DLL GDALDestroyScaledProgress( void * );
00248
00249
00250
00251
00252
00253 void CPL_DLL GDALAllRegister( void );
00254
00255 GDALDatasetH CPL_DLL GDALCreate( GDALDriverH hDriver,
00256 const char *, int, int, int, GDALDataType,
00257 char ** );
00258 GDALDatasetH CPL_DLL GDALCreateCopy( GDALDriverH, const char *, GDALDatasetH,
00259 int, char **, GDALProgressFunc, void * );
00260
00261 GDALDatasetH CPL_DLL GDALOpen( const char *, GDALAccess );
00262
00263 GDALDriverH CPL_DLL GDALGetDriverByName( const char * );
00264 int CPL_DLL GDALGetDriverCount();
00265 GDALDriverH CPL_DLL GDALGetDriver( int );
00266 int CPL_DLL GDALRegisterDriver( GDALDriverH );
00267 void CPL_DLL GDALDeregisterDriver( GDALDriverH );
00268 CPLErr CPL_DLL GDALDeleteDataset( GDALDriverH, const char * );
00269
00270 const char CPL_DLL *GDALGetDriverShortName( GDALDriverH );
00271 const char CPL_DLL *GDALGetDriverLongName( GDALDriverH );
00272 const char CPL_DLL *GDALGetDriverHelpTopic( GDALDriverH );
00273
00274
00275
00276
00277
00279 typedef struct
00280 {
00282 char *pszId;
00283
00285 char *pszInfo;
00286
00288 double dfGCPPixel;
00290 double dfGCPLine;
00291
00293 double dfGCPX;
00294
00296 double dfGCPY;
00297
00299 double dfGCPZ;
00300 } GDAL_GCP;
00301
00302 void CPL_DLL GDALInitGCPs( int, GDAL_GCP * );
00303 void CPL_DLL GDALDeinitGCPs( int, GDAL_GCP * );
00304 GDAL_GCP CPL_DLL *GDALDuplicateGCPs( int, const GDAL_GCP * );
00305
00306
00307
00308
00309
00310 char CPL_DLL **GDALGetMetadata( GDALMajorObjectH, const char * );
00311 CPLErr CPL_DLL GDALSetMetadata( GDALMajorObjectH, char **,
00312 const char * );
00313 char CPL_DLL **GDALGetMetadataItem( GDALMajorObjectH, const char * );
00314 CPLErr CPL_DLL GDALSetMetadataItem( GDALMajorObjectH,
00315 const char *, const char *,
00316 const char * );
00317 const char CPL_DLL *GDALGetDescription( GDALMajorObjectH );
00318
00319
00320
00321
00322
00323 GDALDriverH CPL_DLL GDALGetDatasetDriver( GDALDatasetH );
00324 void CPL_DLL GDALClose( GDALDatasetH );
00325 int CPL_DLL GDALGetRasterXSize( GDALDatasetH );
00326 int CPL_DLL GDALGetRasterYSize( GDALDatasetH );
00327 int CPL_DLL GDALGetRasterCount( GDALDatasetH );
00328 GDALRasterBandH CPL_DLL GDALGetRasterBand( GDALDatasetH, int );
00329
00330 const char CPL_DLL *GDALGetProjectionRef( GDALDatasetH );
00331 CPLErr CPL_DLL GDALSetProjection( GDALDatasetH, const char * );
00332 CPLErr CPL_DLL GDALGetGeoTransform( GDALDatasetH, double * );
00333 CPLErr CPL_DLL GDALSetGeoTransform( GDALDatasetH, double * );
00334
00335 int CPL_DLL GDALGetGCPCount( GDALDatasetH );
00336 const char CPL_DLL *GDALGetGCPProjection( GDALDatasetH );
00337 const GDAL_GCP CPL_DLL *GDALGetGCPs( GDALDatasetH );
00338
00339 void CPL_DLL *GDALGetInternalHandle( GDALDatasetH, const char * );
00340 int CPL_DLL GDALReferenceDataset( GDALDatasetH );
00341 int CPL_DLL GDALDereferenceDataset( GDALDatasetH );
00342
00343 CPLErr CPL_DLL GDALBuildOverviews( GDALDatasetH, const char *, int, int *,
00344 int, int *, GDALProgressFunc, void * );
00345
00346
00347
00348
00349
00350 GDALDataType CPL_DLL GDALGetRasterDataType( GDALRasterBandH );
00351 void CPL_DLL GDALGetBlockSize( GDALRasterBandH,
00352 int * pnXSize, int * pnYSize );
00353
00354 CPLErr CPL_DLL GDALRasterIO( GDALRasterBandH hRBand, GDALRWFlag eRWFlag,
00355 int nDSXOff, int nDSYOff,
00356 int nDSXSize, int nDSYSize,
00357 void * pBuffer, int nBXSize, int nBYSize,
00358 GDALDataType eBDataType,
00359 int nPixelSpace, int nLineSpace );
00360 CPLErr CPL_DLL GDALReadBlock( GDALRasterBandH, int, int, void * );
00361 CPLErr CPL_DLL GDALWriteBlock( GDALRasterBandH, int, int, void * );
00362 int CPL_DLL GDALGetRasterBandXSize( GDALRasterBandH );
00363 int CPL_DLL GDALGetRasterBandYSize( GDALRasterBandH );
00364 char CPL_DLL **GDALGetRasterMetadata( GDALRasterBandH );
00365
00366 GDALColorInterp CPL_DLL GDALGetRasterColorInterpretation( GDALRasterBandH );
00367 GDALColorTableH CPL_DLL GDALGetRasterColorTable( GDALRasterBandH );
00368 CPLErr CPL_DLL GDALSetRasterColorTable( GDALRasterBandH, GDALColorTableH );
00369 int CPL_DLL GDALHasArbitraryOverviews( GDALRasterBandH );
00370 int CPL_DLL GDALGetOverviewCount( GDALRasterBandH );
00371 GDALRasterBandH CPL_DLL GDALGetOverview( GDALRasterBandH, int );
00372 double CPL_DLL GDALGetRasterNoDataValue( GDALRasterBandH, int * );
00373 CPLErr CPL_DLL GDALSetRasterNoDataValue( GDALRasterBandH, double );
00374 char CPL_DLL ** GDALGetRasterCategoryNames( GDALRasterBandH );
00375 CPLErr CPL_DLL GDALSetRasterCategoryNames( GDALRasterBandH, char ** );
00376 double CPL_DLL GDALGetRasterMinimum( GDALRasterBandH, int *pbSuccess );
00377 double CPL_DLL GDALGetRasterMaximum( GDALRasterBandH, int *pbSuccess );
00378 void CPL_DLL GDALComputeRasterMinMax( GDALRasterBandH hBand, int bApproxOK,
00379 double adfMinMax[2] );
00380 CPLErr CPL_DLL GDALFlushRasterCache( GDALRasterBandH hBand );
00381 CPLErr CPL_DLL GDALGetRasterHistogram( GDALRasterBandH hBand,
00382 double dfMin, double dfMax,
00383 int nBuckets, int *panHistogram,
00384 int bIncludeOutOfRange, int bApproxOK,
00385 GDALProgressFunc pfnProgress,
00386 void * pProgressData );
00387 int CPL_DLL GDALGetRandomRasterSample( GDALRasterBandH, int, float * );
00388 GDALRasterBandH CPL_DLL GDALGetRasterSampleOverview( GDALRasterBandH, int );
00389
00390
00391
00392
00393 void CPL_DLL GDALSwapWords( void *pData, int nWordSize, int nWordCount,
00394 int nWordSkip );
00395 void CPL_DLL
00396 GDALCopyWords( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset,
00397 void * pDstData, GDALDataType eDstType, int nDstPixelOffset,
00398 int nWordCount );
00399
00400
00401
00402
00403
00405 typedef struct
00406 {
00408 short c1;
00409
00411 short c2;
00412
00414 short c3;
00415
00417 short c4;
00418 } GDALColorEntry;
00419
00420 GDALColorTableH CPL_DLL GDALCreateColorTable( GDALPaletteInterp );
00421 void CPL_DLL GDALDestroyColorTable( GDALColorTableH );
00422 GDALColorTableH CPL_DLL GDALCloneColorTable( GDALColorTableH );
00423 GDALPaletteInterp CPL_DLL GDALGetPaletteInterpretation( GDALColorTableH );
00424 int CPL_DLL GDALGetColorEntryCount( GDALColorTableH );
00425 const GDALColorEntry CPL_DLL *GDALGetColorEntry( GDALColorTableH, int );
00426 int CPL_DLL GDALGetColorEntryAsRGB( GDALColorTableH, int, GDALColorEntry *);
00427 void CPL_DLL GDALSetColorEntry( GDALColorTableH, int, const GDALColorEntry * );
00428
00429
00430
00431
00432
00433 GDALProjDefH CPL_DLL GDALCreateProjDef( const char * );
00434 CPLErr CPL_DLL GDALReprojectToLongLat( GDALProjDefH, double *, double * );
00435 CPLErr CPL_DLL GDALReprojectFromLongLat( GDALProjDefH, double *, double * );
00436 void CPL_DLL GDALDestroyProjDef( GDALProjDefH );
00437 const char CPL_DLL *GDALDecToDMS( double, const char *, int );
00438
00439
00440
00441
00442
00443 void CPL_DLL GDALSetCacheMax( int nBytes );
00444 int CPL_DLL GDALGetCacheMax();
00445 int CPL_DLL GDALGetCacheUsed();
00446 int CPL_DLL GDALFlushCacheBlock();
00447
00448 CPL_C_END
00449
00450 #endif