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

gdal.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_h-source.html,v 1.6 2000/11/06 04:49:01 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.6  2000/11/06 04:49:01  warmerda
00031  * *** empty log message ***
00031  *
00032  * Revision 1.33  2000/10/06 18:30:01  warmerda
00033  * Fixed CPL_DLL position for GDALGetRasterCategoryNames().
00034  *
00035  * Revision 1.32  2000/10/06 15:23:03  warmerda
00036  * added some new functions
00037  *
00038  * Revision 1.31  2000/08/25 14:26:51  warmerda
00039  * added GDALHasArbitraryOverviews
00040  *
00041  * Revision 1.30  2000/08/18 15:24:48  warmerda
00042  * added GDALTermProgress
00043  *
00044  * Revision 1.29  2000/07/11 14:35:43  warmerda
00045  * added documentation
00046  *
00047  * Revision 1.28  2000/06/27 17:30:21  warmerda
00048  * added GDALGetRasterSampleOverview
00049  *
00050  * Revision 1.27  2000/06/26 22:17:49  warmerda
00051  * added scaled progress support
00052  *
00053  * Revision 1.26  2000/06/26 18:47:31  warmerda
00054  * added GDALBuildOverviews
00055  *
00056  * Revision 1.25  2000/06/26 15:26:21  warmerda
00057  * added GDALGetDescription
00058  *
00059  * Revision 1.24  2000/06/05 17:24:05  warmerda
00060  * added real complex support
00061  *
00062  * Revision 1.23  2000/04/30 23:22:16  warmerda
00063  * added CreateCopy support
00064  *
00065  * Revision 1.22  2000/04/26 18:25:29  warmerda
00066  * added missing CPL_DLL attributes
00067  *
00068  * Revision 1.21  2000/04/21 21:54:37  warmerda
00069  * updated metadata API
00070  *
00071  * Revision 1.20  2000/03/31 13:41:25  warmerda
00072  * added gcps
00073  *
00074  * Revision 1.19  2000/03/24 00:09:05  warmerda
00075  * rewrote cache management
00076  *
00077  * Revision 1.18  2000/03/09 23:22:03  warmerda
00078  * added GetHistogram
00079  *
00080  * Revision 1.17  2000/03/08 19:59:16  warmerda
00081  * added GDALFlushRasterCache
00082  *
00083  * Revision 1.16  2000/03/06 21:50:37  warmerda
00084  * added min/max support
00085  *
00086  * Revision 1.15  2000/03/06 02:19:56  warmerda
00087  * added lots of new functions
00088  *
00089  * Revision 1.14  2000/01/31 14:24:36  warmerda
00090  * implemented dataset delete
00091  *
00092  * Revision 1.13  1999/11/11 21:59:06  warmerda
00093  * added GetDriver() for datasets
00094  *
00095  * Revision 1.12  1999/10/21 13:23:28  warmerda
00096  * Added C callable driver related functions.
00097  *
00098  * Revision 1.11  1999/10/01 14:44:02  warmerda
00099  * added documentation
00100  *
00101  * Revision 1.10  1999/07/23 19:35:22  warmerda
00102  * added GDALSwapWords(), GDALCopyWords()
00103  *
00104  * Revision 1.9  1999/05/23 02:46:26  warmerda
00105  * Added documentation short description.
00106  *
00107  * Revision 1.8  1999/04/21 04:16:13  warmerda
00108  * experimental docs
00109  *
00110  * Revision 1.7  1999/03/02 21:09:48  warmerda
00111  * add GDALDecToDMS()
00112  *
00113  * Revision 1.6  1999/01/11 15:36:17  warmerda
00114  * Added projections support, and a few other things.
00115  *
00116  * Revision 1.5  1998/12/31 18:53:33  warmerda
00117  * Add GDALGetDriverByName
00118  *
00119  * Revision 1.4  1998/12/06 22:16:27  warmerda
00120  * Added GDALCreate().
00121  *
00122  * Revision 1.3  1998/12/06 02:50:36  warmerda
00123  * Added three new functions.
00124  *
00125  * Revision 1.2  1998/12/03 18:34:05  warmerda
00126  * Update to use CPL
00127  *
00128  * Revision 1.1  1998/10/18 06:15:10  warmerda
00129  * Initial implementation.
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 /*      Significant constants.                                          */
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          /* maximum type # + 1 */
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 /*      GDAL Specific error codes.                                      */
00221 /*                                                                      */
00222 /*      error codes 100 to 299 reserved for GDAL.                       */
00223 /* -------------------------------------------------------------------- */
00224 #define CPLE_WrongFormat        200
00225 
00226 /* -------------------------------------------------------------------- */
00227 /*      Define handle types related to various internal classes.        */
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 /*      Callback "progress" function.                                   */
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 /*      Registration/driver related.                                    */
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 /*      GDAL_GCP                                                        */
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 /*      major objects (dataset, and, driver, drivermanager).            */
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 /*      GDALDataset class ... normally this represents one file.        */
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 /*      GDALRasterBand ... one band/channel in a dataset.               */
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 /* need to add functions related to block cache */
00391 
00392 /* helper functions */
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 /*      Color tables.                                                   */
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 /*      Projections                                                     */
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 /*      GDAL Cache Management                                           */
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 /* ndef GDAL_H_INCLUDED */

doxygen1.2.3-20001105 Dimitri van Heesch, © 1997-2000