00001 /****************************************************************************** 00002 * $Id: gdal_h-source.html,v 1.9 2001/07/05 13:24:08 warmerda Exp $ 00003 * 00004 * Name: gdal.h 00005 * Project: GDAL Core 00006 * Purpose: GDAL Core C/Public declarations. 00007 * Author: Frank Warmerdam, warmerda@home.com 00008 * 00009 ****************************************************************************** 00010 * Copyright (c) 1998, Frank Warmerdam 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************** 00030 * 00031 * $Log: gdal_h-source.html,v $ 00031 * Revision 1.9 2001/07/05 13:24:08 warmerda 00031 * *** empty log message *** 00031 * 00032 * Revision 1.36 2001/07/05 13:13:40 warmerda 00033 * added UnitType from C support 00034 * 00035 * Revision 1.35 2001/05/01 18:09:25 warmerda 00036 * added GDALReadWorldFile() 00037 * 00038 * Revision 1.34 2001/01/30 22:32:42 warmerda 00039 * added AVERAGE_MP (magnitude preserving averaging) overview resampling type 00040 * 00041 * Revision 1.33 2000/10/06 18:30:01 warmerda 00042 * Fixed CPL_DLL position for GDALGetRasterCategoryNames(). 00043 * 00044 * Revision 1.32 2000/10/06 15:23:03 warmerda 00045 * added some new functions 00046 * 00047 * Revision 1.31 2000/08/25 14:26:51 warmerda 00048 * added GDALHasArbitraryOverviews 00049 * 00050 * Revision 1.30 2000/08/18 15:24:48 warmerda 00051 * added GDALTermProgress 00052 * 00053 * Revision 1.29 2000/07/11 14:35:43 warmerda 00054 * added documentation 00055 * 00056 * Revision 1.28 2000/06/27 17:30:21 warmerda 00057 * added GDALGetRasterSampleOverview 00058 * 00059 * Revision 1.27 2000/06/26 22:17:49 warmerda 00060 * added scaled progress support 00061 * 00062 * Revision 1.26 2000/06/26 18:47:31 warmerda 00063 * added GDALBuildOverviews 00064 * 00065 * Revision 1.25 2000/06/26 15:26:21 warmerda 00066 * added GDALGetDescription 00067 * 00068 * Revision 1.24 2000/06/05 17:24:05 warmerda 00069 * added real complex support 00070 * 00071 * Revision 1.23 2000/04/30 23:22:16 warmerda 00072 * added CreateCopy support 00073 * 00074 * Revision 1.22 2000/04/26 18:25:29 warmerda 00075 * added missing CPL_DLL attributes 00076 * 00077 * Revision 1.21 2000/04/21 21:54:37 warmerda 00078 * updated metadata API 00079 * 00080 * Revision 1.20 2000/03/31 13:41:25 warmerda 00081 * added gcps 00082 * 00083 * Revision 1.19 2000/03/24 00:09:05 warmerda 00084 * rewrote cache management 00085 * 00086 * Revision 1.18 2000/03/09 23:22:03 warmerda 00087 * added GetHistogram 00088 * 00089 * Revision 1.17 2000/03/08 19:59:16 warmerda 00090 * added GDALFlushRasterCache 00091 * 00092 * Revision 1.16 2000/03/06 21:50:37 warmerda 00093 * added min/max support 00094 * 00095 * Revision 1.15 2000/03/06 02:19:56 warmerda 00096 * added lots of new functions 00097 * 00098 * Revision 1.14 2000/01/31 14:24:36 warmerda 00099 * implemented dataset delete 00100 * 00101 * Revision 1.13 1999/11/11 21:59:06 warmerda 00102 * added GetDriver() for datasets 00103 * 00104 * Revision 1.12 1999/10/21 13:23:28 warmerda 00105 * Added C callable driver related functions. 00106 * 00107 * Revision 1.11 1999/10/01 14:44:02 warmerda 00108 * added documentation 00109 * 00110 * Revision 1.10 1999/07/23 19:35:22 warmerda 00111 * added GDALSwapWords(), GDALCopyWords() 00112 * 00113 * Revision 1.9 1999/05/23 02:46:26 warmerda 00114 * Added documentation short description. 00115 * 00116 * Revision 1.8 1999/04/21 04:16:13 warmerda 00117 * experimental docs 00118 * 00119 * Revision 1.7 1999/03/02 21:09:48 warmerda 00120 * add GDALDecToDMS() 00121 * 00122 * Revision 1.6 1999/01/11 15:36:17 warmerda 00123 * Added projections support, and a few other things. 00124 * 00125 * Revision 1.5 1998/12/31 18:53:33 warmerda 00126 * Add GDALGetDriverByName 00127 * 00128 * Revision 1.4 1998/12/06 22:16:27 warmerda 00129 * Added GDALCreate(). 00130 * 00131 * Revision 1.3 1998/12/06 02:50:36 warmerda 00132 * Added three new functions. 00133 * 00134 * Revision 1.2 1998/12/03 18:34:05 warmerda 00135 * Update to use CPL 00136 * 00137 * Revision 1.1 1998/10/18 06:15:10 warmerda 00138 * Initial implementation. 00139 * 00140 */ 00141 00142 #ifndef GDAL_H_INCLUDED 00143 #define GDAL_H_INCLUDED 00144 00151 #include "cpl_port.h" 00152 #include "cpl_error.h" 00153 00154 /* -------------------------------------------------------------------- */ 00155 /* Significant constants. */ 00156 /* -------------------------------------------------------------------- */ 00157 00158 CPL_C_START 00159 00161 typedef enum { 00162 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, 00174 GDT_TypeCount = 12 /* maximum type # + 1 */ 00175 } GDALDataType; 00176 00177 int CPL_DLL GDALGetDataTypeSize( GDALDataType ); 00178 int CPL_DLL GDALDataTypeIsComplex( GDALDataType ); 00179 const char CPL_DLL *GDALGetDataTypeName( GDALDataType ); 00180 GDALDataType CPL_DLL GDALDataTypeUnion( GDALDataType, GDALDataType ); 00181 00183 typedef enum { GA_ReadOnly = 0, GA_Update = 1 00186 } GDALAccess; 00187 00189 typedef enum { GF_Read = 0, GF_Write = 1 00192 } GDALRWFlag; 00193 00195 typedef enum 00196 { 00197 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 00211 } GDALColorInterp; 00212 00214 const char CPL_DLL *GDALGetColorInterpretationName( GDALColorInterp ); 00215 00217 typedef enum 00218 { GPI_Gray=0, GPI_RGB=1, GPI_CMYK=2, GPI_HLS=3 00223 } GDALPaletteInterp; 00224 00226 const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp ); 00227 00228 /* -------------------------------------------------------------------- */ 00229 /* GDAL Specific error codes. */ 00230 /* */ 00231 /* error codes 100 to 299 reserved for GDAL. */ 00232 /* -------------------------------------------------------------------- */ 00233 #define CPLE_WrongFormat 200 00234 00235 /* -------------------------------------------------------------------- */ 00236 /* Define handle types related to various internal classes. */ 00237 /* -------------------------------------------------------------------- */ 00238 typedef void *GDALMajorObjectH; 00239 typedef void *GDALDatasetH; 00240 typedef void *GDALRasterBandH; 00241 typedef void *GDALDriverH; 00242 typedef void *GDALProjDefH; 00243 typedef void *GDALColorTableH; 00244 00245 /* -------------------------------------------------------------------- */ 00246 /* Callback "progress" function. */ 00247 /* -------------------------------------------------------------------- */ 00250 typedef int (*GDALProgressFunc)(double,const char *, void *); 00251 int CPL_DLL GDALDummyProgress( double, const char *, void *); 00252 int CPL_DLL GDALTermProgress( double, const char *, void *); 00253 int CPL_DLL GDALScaledProgress( double, const char *, void *); 00254 void CPL_DLL *GDALCreateScaledProgress( double, double, 00255 GDALProgressFunc, void * ); 00256 void CPL_DLL GDALDestroyScaledProgress( void * ); 00257 00258 /* ==================================================================== */ 00259 /* Registration/driver related. */ 00260 /* ==================================================================== */ 00261 00262 void CPL_DLL GDALAllRegister( void ); 00263 00264 GDALDatasetH CPL_DLL GDALCreate( GDALDriverH hDriver, 00265 const char *, int, int, int, GDALDataType, 00266 char ** ); 00267 GDALDatasetH CPL_DLL GDALCreateCopy( GDALDriverH, const char *, GDALDatasetH, 00268 int, char **, GDALProgressFunc, void * ); 00269 00270 GDALDatasetH CPL_DLL GDALOpen( const char *, GDALAccess ); 00271 00272 GDALDriverH CPL_DLL GDALGetDriverByName( const char * ); 00273 int CPL_DLL GDALGetDriverCount(); 00274 GDALDriverH CPL_DLL GDALGetDriver( int ); 00275 int CPL_DLL GDALRegisterDriver( GDALDriverH ); 00276 void CPL_DLL GDALDeregisterDriver( GDALDriverH ); 00277 CPLErr CPL_DLL GDALDeleteDataset( GDALDriverH, const char * ); 00278 00279 const char CPL_DLL *GDALGetDriverShortName( GDALDriverH ); 00280 const char CPL_DLL *GDALGetDriverLongName( GDALDriverH ); 00281 const char CPL_DLL *GDALGetDriverHelpTopic( GDALDriverH ); 00282 00283 /* ==================================================================== */ 00284 /* GDAL_GCP */ 00285 /* ==================================================================== */ 00286 00288 typedef struct 00289 { 00291 char *pszId; 00292 00294 char *pszInfo; 00295 00297 double dfGCPPixel; 00299 double dfGCPLine; 00300 00302 double dfGCPX; 00303 00305 double dfGCPY; 00306 00308 double dfGCPZ; 00309 } GDAL_GCP; 00310 00311 void CPL_DLL GDALInitGCPs( int, GDAL_GCP * ); 00312 void CPL_DLL GDALDeinitGCPs( int, GDAL_GCP * ); 00313 GDAL_GCP CPL_DLL *GDALDuplicateGCPs( int, const GDAL_GCP * ); 00314 00315 /* ==================================================================== */ 00316 /* major objects (dataset, and, driver, drivermanager). */ 00317 /* ==================================================================== */ 00318 00319 char CPL_DLL **GDALGetMetadata( GDALMajorObjectH, const char * ); 00320 CPLErr CPL_DLL GDALSetMetadata( GDALMajorObjectH, char **, 00321 const char * ); 00322 char CPL_DLL **GDALGetMetadataItem( GDALMajorObjectH, const char * ); 00323 CPLErr CPL_DLL GDALSetMetadataItem( GDALMajorObjectH, 00324 const char *, const char *, 00325 const char * ); 00326 const char CPL_DLL *GDALGetDescription( GDALMajorObjectH ); 00327 00328 /* ==================================================================== */ 00329 /* GDALDataset class ... normally this represents one file. */ 00330 /* ==================================================================== */ 00331 00332 GDALDriverH CPL_DLL GDALGetDatasetDriver( GDALDatasetH ); 00333 void CPL_DLL GDALClose( GDALDatasetH ); 00334 int CPL_DLL GDALGetRasterXSize( GDALDatasetH ); 00335 int CPL_DLL GDALGetRasterYSize( GDALDatasetH ); 00336 int CPL_DLL GDALGetRasterCount( GDALDatasetH ); 00337 GDALRasterBandH CPL_DLL GDALGetRasterBand( GDALDatasetH, int ); 00338 00339 const char CPL_DLL *GDALGetProjectionRef( GDALDatasetH ); 00340 CPLErr CPL_DLL GDALSetProjection( GDALDatasetH, const char * ); 00341 CPLErr CPL_DLL GDALGetGeoTransform( GDALDatasetH, double * ); 00342 CPLErr CPL_DLL GDALSetGeoTransform( GDALDatasetH, double * ); 00343 00344 int CPL_DLL GDALGetGCPCount( GDALDatasetH ); 00345 const char CPL_DLL *GDALGetGCPProjection( GDALDatasetH ); 00346 const GDAL_GCP CPL_DLL *GDALGetGCPs( GDALDatasetH ); 00347 00348 void CPL_DLL *GDALGetInternalHandle( GDALDatasetH, const char * ); 00349 int CPL_DLL GDALReferenceDataset( GDALDatasetH ); 00350 int CPL_DLL GDALDereferenceDataset( GDALDatasetH ); 00351 00352 CPLErr CPL_DLL GDALBuildOverviews( GDALDatasetH, const char *, int, int *, 00353 int, int *, GDALProgressFunc, void * ); 00354 00355 /* ==================================================================== */ 00356 /* GDALRasterBand ... one band/channel in a dataset. */ 00357 /* ==================================================================== */ 00358 00359 GDALDataType CPL_DLL GDALGetRasterDataType( GDALRasterBandH ); 00360 void CPL_DLL GDALGetBlockSize( GDALRasterBandH, 00361 int * pnXSize, int * pnYSize ); 00362 00363 CPLErr CPL_DLL GDALRasterIO( GDALRasterBandH hRBand, GDALRWFlag eRWFlag, 00364 int nDSXOff, int nDSYOff, 00365 int nDSXSize, int nDSYSize, 00366 void * pBuffer, int nBXSize, int nBYSize, 00367 GDALDataType eBDataType, 00368 int nPixelSpace, int nLineSpace ); 00369 CPLErr CPL_DLL GDALReadBlock( GDALRasterBandH, int, int, void * ); 00370 CPLErr CPL_DLL GDALWriteBlock( GDALRasterBandH, int, int, void * ); 00371 int CPL_DLL GDALGetRasterBandXSize( GDALRasterBandH ); 00372 int CPL_DLL GDALGetRasterBandYSize( GDALRasterBandH ); 00373 char CPL_DLL **GDALGetRasterMetadata( GDALRasterBandH ); 00374 00375 GDALColorInterp CPL_DLL GDALGetRasterColorInterpretation( GDALRasterBandH ); 00376 GDALColorTableH CPL_DLL GDALGetRasterColorTable( GDALRasterBandH ); 00377 CPLErr CPL_DLL GDALSetRasterColorTable( GDALRasterBandH, GDALColorTableH ); 00378 int CPL_DLL GDALHasArbitraryOverviews( GDALRasterBandH ); 00379 int CPL_DLL GDALGetOverviewCount( GDALRasterBandH ); 00380 GDALRasterBandH CPL_DLL GDALGetOverview( GDALRasterBandH, int ); 00381 double CPL_DLL GDALGetRasterNoDataValue( GDALRasterBandH, int * ); 00382 CPLErr CPL_DLL GDALSetRasterNoDataValue( GDALRasterBandH, double ); 00383 char CPL_DLL ** GDALGetRasterCategoryNames( GDALRasterBandH ); 00384 CPLErr CPL_DLL GDALSetRasterCategoryNames( GDALRasterBandH, char ** ); 00385 double CPL_DLL GDALGetRasterMinimum( GDALRasterBandH, int *pbSuccess ); 00386 double CPL_DLL GDALGetRasterMaximum( GDALRasterBandH, int *pbSuccess ); 00387 const char CPL_DLL *GDALGetRasterUnitType( GDALRasterBandH ); 00388 void CPL_DLL GDALComputeRasterMinMax( GDALRasterBandH hBand, int bApproxOK, 00389 double adfMinMax[2] ); 00390 CPLErr CPL_DLL GDALFlushRasterCache( GDALRasterBandH hBand ); 00391 CPLErr CPL_DLL GDALGetRasterHistogram( GDALRasterBandH hBand, 00392 double dfMin, double dfMax, 00393 int nBuckets, int *panHistogram, 00394 int bIncludeOutOfRange, int bApproxOK, 00395 GDALProgressFunc pfnProgress, 00396 void * pProgressData ); 00397 int CPL_DLL GDALGetRandomRasterSample( GDALRasterBandH, int, float * ); 00398 GDALRasterBandH CPL_DLL GDALGetRasterSampleOverview( GDALRasterBandH, int ); 00399 00400 CPLErr GDALComputeBandStats( GDALRasterBandH hBand, int nSampleStep, 00401 double *pdfMean, double *pdfStdDev, 00402 GDALProgressFunc pfnProgress, 00403 void *pProgressData ); 00404 CPLErr GDALOverviewMagnitudeCorrection( GDALRasterBandH hBaseBand, 00405 int nOverviewCount, 00406 GDALRasterBandH *pahOverviews, 00407 GDALProgressFunc pfnProgress, 00408 void *pProgressData ); 00409 00410 /* -------------------------------------------------------------------- */ 00411 /* Helper functions. */ 00412 /* -------------------------------------------------------------------- */ 00413 void CPL_DLL GDALSwapWords( void *pData, int nWordSize, int nWordCount, 00414 int nWordSkip ); 00415 void CPL_DLL 00416 GDALCopyWords( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset, 00417 void * pDstData, GDALDataType eDstType, int nDstPixelOffset, 00418 int nWordCount ); 00419 00420 int GDALReadWorldFile( const char *pszBaseFilename, 00421 const char *pszExtension, 00422 double * padfGeoTransform ); 00423 00424 /* ==================================================================== */ 00425 /* Color tables. */ 00426 /* ==================================================================== */ 00428 typedef struct 00429 { 00431 short c1; 00432 00434 short c2; 00435 00437 short c3; 00438 00440 short c4; 00441 } GDALColorEntry; 00442 00443 GDALColorTableH CPL_DLL GDALCreateColorTable( GDALPaletteInterp ); 00444 void CPL_DLL GDALDestroyColorTable( GDALColorTableH ); 00445 GDALColorTableH CPL_DLL GDALCloneColorTable( GDALColorTableH ); 00446 GDALPaletteInterp CPL_DLL GDALGetPaletteInterpretation( GDALColorTableH ); 00447 int CPL_DLL GDALGetColorEntryCount( GDALColorTableH ); 00448 const GDALColorEntry CPL_DLL *GDALGetColorEntry( GDALColorTableH, int ); 00449 int CPL_DLL GDALGetColorEntryAsRGB( GDALColorTableH, int, GDALColorEntry *); 00450 void CPL_DLL GDALSetColorEntry( GDALColorTableH, int, const GDALColorEntry * ); 00451 00452 /* ==================================================================== */ 00453 /* Projections */ 00454 /* ==================================================================== */ 00455 00456 GDALProjDefH CPL_DLL GDALCreateProjDef( const char * ); 00457 CPLErr CPL_DLL GDALReprojectToLongLat( GDALProjDefH, double *, double * ); 00458 CPLErr CPL_DLL GDALReprojectFromLongLat( GDALProjDefH, double *, double * ); 00459 void CPL_DLL GDALDestroyProjDef( GDALProjDefH ); 00460 const char CPL_DLL *GDALDecToDMS( double, const char *, int ); 00461 00462 /* ==================================================================== */ 00463 /* GDAL Cache Management */ 00464 /* ==================================================================== */ 00465 00466 void CPL_DLL GDALSetCacheMax( int nBytes ); 00467 int CPL_DLL GDALGetCacheMax(); 00468 int CPL_DLL GDALGetCacheUsed(); 00469 int CPL_DLL GDALFlushCacheBlock(); 00470 00471 CPL_C_END 00472 00473 #endif /* ndef GDAL_H_INCLUDED */