gdal.h 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  1. /******************************************************************************
  2. * $Id: gdal.h 29330 2015-06-14 12:11:11Z rouault $
  3. *
  4. * Project: GDAL Core
  5. * Purpose: GDAL Core C/Public declarations.
  6. * Author: Frank Warmerdam, warmerdam@pobox.com
  7. *
  8. ******************************************************************************
  9. * Copyright (c) 1998, 2002 Frank Warmerdam
  10. * Copyright (c) 2007-2014, Even Rouault <even dot rouault at mines-paris dot org>
  11. *
  12. * Permission is hereby granted, free of charge, to any person obtaining a
  13. * copy of this software and associated documentation files (the "Software"),
  14. * to deal in the Software without restriction, including without limitation
  15. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  16. * and/or sell copies of the Software, and to permit persons to whom the
  17. * Software is furnished to do so, subject to the following conditions:
  18. *
  19. * The above copyright notice and this permission notice shall be included
  20. * in all copies or substantial portions of the Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  23. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  25. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  27. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  28. * DEALINGS IN THE SOFTWARE.
  29. ****************************************************************************/
  30. #ifndef GDAL_H_INCLUDED
  31. #define GDAL_H_INCLUDED
  32. /**
  33. * \file gdal.h
  34. *
  35. * Public (C callable) GDAL entry points.
  36. */
  37. #ifndef DOXYGEN_SKIP
  38. #include "gdal_version.h"
  39. #include "cpl_port.h"
  40. #include "cpl_error.h"
  41. #include "cpl_progress.h"
  42. #include "cpl_virtualmem.h"
  43. #include "cpl_minixml.h"
  44. #include "ogr_api.h"
  45. #endif
  46. /* -------------------------------------------------------------------- */
  47. /* Significant constants. */
  48. /* -------------------------------------------------------------------- */
  49. CPL_C_START
  50. /*! Pixel data types */
  51. typedef enum {
  52. /*! Unknown or unspecified type */ GDT_Unknown = 0,
  53. /*! Eight bit unsigned integer */ GDT_Byte = 1,
  54. /*! Sixteen bit unsigned integer */ GDT_UInt16 = 2,
  55. /*! Sixteen bit signed integer */ GDT_Int16 = 3,
  56. /*! Thirty two bit unsigned integer */ GDT_UInt32 = 4,
  57. /*! Thirty two bit signed integer */ GDT_Int32 = 5,
  58. /*! Thirty two bit floating point */ GDT_Float32 = 6,
  59. /*! Sixty four bit floating point */ GDT_Float64 = 7,
  60. /*! Complex Int16 */ GDT_CInt16 = 8,
  61. /*! Complex Int32 */ GDT_CInt32 = 9,
  62. /*! Complex Float32 */ GDT_CFloat32 = 10,
  63. /*! Complex Float64 */ GDT_CFloat64 = 11,
  64. GDT_TypeCount = 12 /* maximum type # + 1 */
  65. } GDALDataType;
  66. int CPL_DLL CPL_STDCALL GDALGetDataTypeSize( GDALDataType );
  67. int CPL_DLL CPL_STDCALL GDALDataTypeIsComplex( GDALDataType );
  68. const char CPL_DLL * CPL_STDCALL GDALGetDataTypeName( GDALDataType );
  69. GDALDataType CPL_DLL CPL_STDCALL GDALGetDataTypeByName( const char * );
  70. GDALDataType CPL_DLL CPL_STDCALL GDALDataTypeUnion( GDALDataType, GDALDataType );
  71. /**
  72. * status of the asynchronous stream
  73. */
  74. typedef enum
  75. {
  76. GARIO_PENDING = 0,
  77. GARIO_UPDATE = 1,
  78. GARIO_ERROR = 2,
  79. GARIO_COMPLETE = 3,
  80. GARIO_TypeCount = 4
  81. } GDALAsyncStatusType;
  82. const char CPL_DLL * CPL_STDCALL GDALGetAsyncStatusTypeName( GDALAsyncStatusType );
  83. GDALAsyncStatusType CPL_DLL CPL_STDCALL GDALGetAsyncStatusTypeByName( const char * );
  84. /*! Flag indicating read/write, or read-only access to data. */
  85. typedef enum {
  86. /*! Read only (no update) access */ GA_ReadOnly = 0,
  87. /*! Read/write access. */ GA_Update = 1
  88. } GDALAccess;
  89. /*! Read/Write flag for RasterIO() method */
  90. typedef enum {
  91. /*! Read data */ GF_Read = 0,
  92. /*! Write data */ GF_Write = 1
  93. } GDALRWFlag;
  94. /* NOTE: values are selected to be consistent with GDALResampleAlg of alg/gdalwarper.h */
  95. /** RasterIO() resampling method.
  96. * @since GDAL 2.0
  97. */
  98. typedef enum
  99. {
  100. /*! Nearest neighbour */ GRIORA_NearestNeighbour = 0,
  101. /*! Bilinear (2x2 kernel) */ GRIORA_Bilinear = 1,
  102. /*! Cubic Convolution Approximation (4x4 kernel) */ GRIORA_Cubic = 2,
  103. /*! Cubic B-Spline Approximation (4x4 kernel) */ GRIORA_CubicSpline = 3,
  104. /*! Lanczos windowed sinc interpolation (6x6 kernel) */ GRIORA_Lanczos = 4,
  105. /*! Average */ GRIORA_Average = 5,
  106. /*! Mode (selects the value which appears most often of all the sampled points) */
  107. GRIORA_Mode = 6,
  108. /*! Gauss blurring */ GRIORA_Gauss = 7
  109. /* NOTE: values 8 to 12 are reserved for max,min,med,Q1,Q3 */
  110. } GDALRIOResampleAlg;
  111. /* NOTE to developers: only add members, and if so edit INIT_RASTERIO_EXTRA_ARG */
  112. /* and INIT_RASTERIO_EXTRA_ARG */
  113. /** Structure to pass extra arguments to RasterIO() method
  114. * @since GDAL 2.0
  115. */
  116. typedef struct
  117. {
  118. /*! Version of structure (to allow future extensions of the structure) */
  119. int nVersion;
  120. /*! Resampling algorithm */
  121. GDALRIOResampleAlg eResampleAlg;
  122. /*! Progress callback */
  123. GDALProgressFunc pfnProgress;
  124. /*! Progress callback user data */
  125. void *pProgressData;
  126. /*! Indicate if dfXOff, dfYOff, dfXSize and dfYSize are set.
  127. Mostly reserved from the VRT driver to communicate a more precise
  128. source window. Must be such that dfXOff - nXOff < 1.0 and
  129. dfYOff - nYOff < 1.0 and nXSize - dfXSize < 1.0 and nYSize - dfYSize < 1.0 */
  130. int bFloatingPointWindowValidity;
  131. /*! Pixel offset to the top left corner. Only valid if bFloatingPointWindowValidity = TRUE */
  132. double dfXOff;
  133. /*! Line offset to the top left corner. Only valid if bFloatingPointWindowValidity = TRUE */
  134. double dfYOff;
  135. /*! Width in pixels of the area of interest. Only valid if bFloatingPointWindowValidity = TRUE */
  136. double dfXSize;
  137. /*! Height in pixels of the area of interest. Only valid if bFloatingPointWindowValidity = TRUE */
  138. double dfYSize;
  139. } GDALRasterIOExtraArg;
  140. #define RASTERIO_EXTRA_ARG_CURRENT_VERSION 1
  141. /** Macro to initialize an instance of GDALRasterIOExtraArg structure.
  142. * @since GDAL 2.0
  143. */
  144. #define INIT_RASTERIO_EXTRA_ARG(s) \
  145. do { (s).nVersion = RASTERIO_EXTRA_ARG_CURRENT_VERSION; \
  146. (s).eResampleAlg = GRIORA_NearestNeighbour; \
  147. (s).pfnProgress = NULL; \
  148. (s).pProgressData = NULL; \
  149. (s).bFloatingPointWindowValidity = FALSE; } while(0)
  150. /*! Types of color interpretation for raster bands. */
  151. typedef enum
  152. {
  153. GCI_Undefined=0,
  154. /*! Greyscale */ GCI_GrayIndex=1,
  155. /*! Paletted (see associated color table) */ GCI_PaletteIndex=2,
  156. /*! Red band of RGBA image */ GCI_RedBand=3,
  157. /*! Green band of RGBA image */ GCI_GreenBand=4,
  158. /*! Blue band of RGBA image */ GCI_BlueBand=5,
  159. /*! Alpha (0=transparent, 255=opaque) */ GCI_AlphaBand=6,
  160. /*! Hue band of HLS image */ GCI_HueBand=7,
  161. /*! Saturation band of HLS image */ GCI_SaturationBand=8,
  162. /*! Lightness band of HLS image */ GCI_LightnessBand=9,
  163. /*! Cyan band of CMYK image */ GCI_CyanBand=10,
  164. /*! Magenta band of CMYK image */ GCI_MagentaBand=11,
  165. /*! Yellow band of CMYK image */ GCI_YellowBand=12,
  166. /*! Black band of CMLY image */ GCI_BlackBand=13,
  167. /*! Y Luminance */ GCI_YCbCr_YBand=14,
  168. /*! Cb Chroma */ GCI_YCbCr_CbBand=15,
  169. /*! Cr Chroma */ GCI_YCbCr_CrBand=16,
  170. /*! Max current value */ GCI_Max=16
  171. } GDALColorInterp;
  172. const char CPL_DLL *GDALGetColorInterpretationName( GDALColorInterp );
  173. GDALColorInterp CPL_DLL GDALGetColorInterpretationByName( const char *pszName );
  174. /*! Types of color interpretations for a GDALColorTable. */
  175. typedef enum
  176. {
  177. /*! Grayscale (in GDALColorEntry.c1) */ GPI_Gray=0,
  178. /*! Red, Green, Blue and Alpha in (in c1, c2, c3 and c4) */ GPI_RGB=1,
  179. /*! Cyan, Magenta, Yellow and Black (in c1, c2, c3 and c4)*/ GPI_CMYK=2,
  180. /*! Hue, Lightness and Saturation (in c1, c2, and c3) */ GPI_HLS=3
  181. } GDALPaletteInterp;
  182. const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp );
  183. /* "well known" metadata items. */
  184. #define GDALMD_AREA_OR_POINT "AREA_OR_POINT"
  185. # define GDALMD_AOP_AREA "Area"
  186. # define GDALMD_AOP_POINT "Point"
  187. /* -------------------------------------------------------------------- */
  188. /* GDAL Specific error codes. */
  189. /* */
  190. /* error codes 100 to 299 reserved for GDAL. */
  191. /* -------------------------------------------------------------------- */
  192. #define CPLE_WrongFormat 200
  193. /* -------------------------------------------------------------------- */
  194. /* Define handle types related to various internal classes. */
  195. /* -------------------------------------------------------------------- */
  196. /** Opaque type used for the C bindings of the C++ GDALMajorObject class */
  197. typedef void *GDALMajorObjectH;
  198. /** Opaque type used for the C bindings of the C++ GDALDataset class */
  199. typedef void *GDALDatasetH;
  200. /** Opaque type used for the C bindings of the C++ GDALRasterBand class */
  201. typedef void *GDALRasterBandH;
  202. /** Opaque type used for the C bindings of the C++ GDALDriver class */
  203. typedef void *GDALDriverH;
  204. /** Opaque type used for the C bindings of the C++ GDALColorTable class */
  205. typedef void *GDALColorTableH;
  206. /** Opaque type used for the C bindings of the C++ GDALRasterAttributeTable class */
  207. typedef void *GDALRasterAttributeTableH;
  208. /** Opaque type used for the C bindings of the C++ GDALAsyncReader class */
  209. typedef void *GDALAsyncReaderH;
  210. /** Type to express pixel, line or band spacing. Signed 64 bit integer. */
  211. typedef GIntBig GSpacing;
  212. /* ==================================================================== */
  213. /* Registration/driver related. */
  214. /* ==================================================================== */
  215. /** Long name of the driver */
  216. #define GDAL_DMD_LONGNAME "DMD_LONGNAME"
  217. /** URL (relative to http://gdal.org/) to the help page of the driver */
  218. #define GDAL_DMD_HELPTOPIC "DMD_HELPTOPIC"
  219. /** MIME type handled by the driver. */
  220. #define GDAL_DMD_MIMETYPE "DMD_MIMETYPE"
  221. /** Extension handled by the driver. */
  222. #define GDAL_DMD_EXTENSION "DMD_EXTENSION"
  223. /** Connection prefix to provide as the file name of the the open function.
  224. * Typically set for non-file based drivers. Generally used with open options.
  225. * @since GDAL 2.0
  226. */
  227. #define GDAL_DMD_CONNECTION_PREFIX "DMD_CONNECTION_PREFIX"
  228. /** List of (space separated) extensions handled by the driver.
  229. * @since GDAL 2.0
  230. */
  231. #define GDAL_DMD_EXTENSIONS "DMD_EXTENSIONS"
  232. /** XML snippet with creation options. */
  233. #define GDAL_DMD_CREATIONOPTIONLIST "DMD_CREATIONOPTIONLIST"
  234. /** XML snippet with open options.
  235. * @since GDAL 2.0
  236. */
  237. #define GDAL_DMD_OPENOPTIONLIST "DMD_OPENOPTIONLIST"
  238. /** List of (space separated) raster data types support by the Create()/CreateCopy() API. */
  239. #define GDAL_DMD_CREATIONDATATYPES "DMD_CREATIONDATATYPES"
  240. /** List of (space separated) vector field types support by the CreateField() API.
  241. * @since GDAL 2.0
  242. * */
  243. #define GDAL_DMD_CREATIONFIELDDATATYPES "DMD_CREATIONFIELDDATATYPES"
  244. /** Capability set by a driver that exposes Subdatasets. */
  245. #define GDAL_DMD_SUBDATASETS "DMD_SUBDATASETS"
  246. /** Capability set by a driver that implements the Open() API. */
  247. #define GDAL_DCAP_OPEN "DCAP_OPEN"
  248. /** Capability set by a driver that implements the Create() API. */
  249. #define GDAL_DCAP_CREATE "DCAP_CREATE"
  250. /** Capability set by a driver that implements the CreateCopy() API. */
  251. #define GDAL_DCAP_CREATECOPY "DCAP_CREATECOPY"
  252. /** Capability set by a driver that can read/create datasets through the VSI*L API. */
  253. #define GDAL_DCAP_VIRTUALIO "DCAP_VIRTUALIO"
  254. /** Capability set by a driver having raster capability.
  255. * @since GDAL 2.0
  256. */
  257. #define GDAL_DCAP_RASTER "DCAP_RASTER"
  258. /** Capability set by a driver having vector capability.
  259. * @since GDAL 2.0
  260. */
  261. #define GDAL_DCAP_VECTOR "DCAP_VECTOR"
  262. /** Capability set by a driver that can create fields with NOT NULL constraint.
  263. * @since GDAL 2.0
  264. */
  265. #define GDAL_DCAP_NOTNULL_FIELDS "DCAP_NOTNULL_FIELDS"
  266. /** Capability set by a driver that can create fields with DEFAULT values.
  267. * @since GDAL 2.0
  268. */
  269. #define GDAL_DCAP_DEFAULT_FIELDS "DCAP_DEFAULT_FIELDS"
  270. /** Capability set by a driver that can create geometry fields with NOT NULL constraint.
  271. * @since GDAL 2.0
  272. */
  273. #define GDAL_DCAP_NOTNULL_GEOMFIELDS "DCAP_NOTNULL_GEOMFIELDS"
  274. void CPL_DLL CPL_STDCALL GDALAllRegister( void );
  275. GDALDatasetH CPL_DLL CPL_STDCALL GDALCreate( GDALDriverH hDriver,
  276. const char *, int, int, int, GDALDataType,
  277. char ** ) CPL_WARN_UNUSED_RESULT;
  278. GDALDatasetH CPL_DLL CPL_STDCALL
  279. GDALCreateCopy( GDALDriverH, const char *, GDALDatasetH,
  280. int, char **, GDALProgressFunc, void * ) CPL_WARN_UNUSED_RESULT;
  281. GDALDriverH CPL_DLL CPL_STDCALL GDALIdentifyDriver( const char * pszFilename,
  282. char ** papszFileList );
  283. GDALDatasetH CPL_DLL CPL_STDCALL
  284. GDALOpen( const char *pszFilename, GDALAccess eAccess ) CPL_WARN_UNUSED_RESULT;
  285. GDALDatasetH CPL_DLL CPL_STDCALL GDALOpenShared( const char *, GDALAccess ) CPL_WARN_UNUSED_RESULT;
  286. /* Note: we define GDAL_OF_READONLY and GDAL_OF_UPDATE to be on purpose */
  287. /* equals to GA_ReadOnly and GA_Update */
  288. /** Open in read-only mode.
  289. * Used by GDALOpenEx().
  290. * @since GDAL 2.0
  291. */
  292. #define GDAL_OF_READONLY 0x00
  293. /** Open in update mode.
  294. * Used by GDALOpenEx().
  295. * @since GDAL 2.0
  296. */
  297. #define GDAL_OF_UPDATE 0x01
  298. /** Allow raster and vector drivers to be used.
  299. * Used by GDALOpenEx().
  300. * @since GDAL 2.0
  301. */
  302. #define GDAL_OF_ALL 0x00
  303. /** Allow raster drivers to be used.
  304. * Used by GDALOpenEx().
  305. * @since GDAL 2.0
  306. */
  307. #define GDAL_OF_RASTER 0x02
  308. /** Allow vector drivers to be used.
  309. * Used by GDALOpenEx().
  310. * @since GDAL 2.0
  311. */
  312. #define GDAL_OF_VECTOR 0x04
  313. /* Some space for GDAL 3.0 new types ;-) */
  314. /*#define GDAL_OF_OTHER_KIND1 0x08 */
  315. /*#define GDAL_OF_OTHER_KIND2 0x10 */
  316. #ifndef DOXYGEN_SKIP
  317. #define GDAL_OF_KIND_MASK 0x1E
  318. #endif
  319. /** Open in shared mode.
  320. * Used by GDALOpenEx().
  321. * @since GDAL 2.0
  322. */
  323. #define GDAL_OF_SHARED 0x20
  324. /** Emit error message in case of failed open.
  325. * Used by GDALOpenEx().
  326. * @since GDAL 2.0
  327. */
  328. #define GDAL_OF_VERBOSE_ERROR 0x40
  329. /** Open as internal dataset. Such dataset isn't registered in the global list
  330. * of opened dataset. Cannot be used with GDAL_OF_SHARED.
  331. *
  332. * Used by GDALOpenEx().
  333. * @since GDAL 2.0
  334. */
  335. #define GDAL_OF_INTERNAL 0x80
  336. GDALDatasetH CPL_DLL CPL_STDCALL GDALOpenEx( const char* pszFilename,
  337. unsigned int nOpenFlags,
  338. const char* const* papszAllowedDrivers,
  339. const char* const* papszOpenOptions,
  340. const char* const* papszSiblingFiles ) CPL_WARN_UNUSED_RESULT;
  341. int CPL_DLL CPL_STDCALL GDALDumpOpenDatasets( FILE * );
  342. GDALDriverH CPL_DLL CPL_STDCALL GDALGetDriverByName( const char * );
  343. int CPL_DLL CPL_STDCALL GDALGetDriverCount( void );
  344. GDALDriverH CPL_DLL CPL_STDCALL GDALGetDriver( int );
  345. void CPL_DLL CPL_STDCALL GDALDestroyDriver( GDALDriverH );
  346. int CPL_DLL CPL_STDCALL GDALRegisterDriver( GDALDriverH );
  347. void CPL_DLL CPL_STDCALL GDALDeregisterDriver( GDALDriverH );
  348. void CPL_DLL CPL_STDCALL GDALDestroyDriverManager( void );
  349. void CPL_DLL GDALDestroy( void );
  350. CPLErr CPL_DLL CPL_STDCALL GDALDeleteDataset( GDALDriverH, const char * );
  351. CPLErr CPL_DLL CPL_STDCALL GDALRenameDataset( GDALDriverH,
  352. const char * pszNewName,
  353. const char * pszOldName );
  354. CPLErr CPL_DLL CPL_STDCALL GDALCopyDatasetFiles( GDALDriverH,
  355. const char * pszNewName,
  356. const char * pszOldName);
  357. int CPL_DLL CPL_STDCALL GDALValidateCreationOptions( GDALDriverH,
  358. char** papszCreationOptions);
  359. /* The following are deprecated */
  360. const char CPL_DLL * CPL_STDCALL GDALGetDriverShortName( GDALDriverH );
  361. const char CPL_DLL * CPL_STDCALL GDALGetDriverLongName( GDALDriverH );
  362. const char CPL_DLL * CPL_STDCALL GDALGetDriverHelpTopic( GDALDriverH );
  363. const char CPL_DLL * CPL_STDCALL GDALGetDriverCreationOptionList( GDALDriverH );
  364. /* ==================================================================== */
  365. /* GDAL_GCP */
  366. /* ==================================================================== */
  367. /** Ground Control Point */
  368. typedef struct
  369. {
  370. /** Unique identifier, often numeric */
  371. char *pszId;
  372. /** Informational message or "" */
  373. char *pszInfo;
  374. /** Pixel (x) location of GCP on raster */
  375. double dfGCPPixel;
  376. /** Line (y) location of GCP on raster */
  377. double dfGCPLine;
  378. /** X position of GCP in georeferenced space */
  379. double dfGCPX;
  380. /** Y position of GCP in georeferenced space */
  381. double dfGCPY;
  382. /** Elevation of GCP, or zero if not known */
  383. double dfGCPZ;
  384. } GDAL_GCP;
  385. void CPL_DLL CPL_STDCALL GDALInitGCPs( int, GDAL_GCP * );
  386. void CPL_DLL CPL_STDCALL GDALDeinitGCPs( int, GDAL_GCP * );
  387. GDAL_GCP CPL_DLL * CPL_STDCALL GDALDuplicateGCPs( int, const GDAL_GCP * );
  388. int CPL_DLL CPL_STDCALL
  389. GDALGCPsToGeoTransform( int nGCPCount, const GDAL_GCP *pasGCPs,
  390. double *padfGeoTransform, int bApproxOK ) CPL_WARN_UNUSED_RESULT;
  391. int CPL_DLL CPL_STDCALL
  392. GDALInvGeoTransform( double *padfGeoTransformIn,
  393. double *padfInvGeoTransformOut ) CPL_WARN_UNUSED_RESULT;
  394. void CPL_DLL CPL_STDCALL GDALApplyGeoTransform( double *, double, double,
  395. double *, double * );
  396. void CPL_DLL GDALComposeGeoTransforms(const double *padfGeoTransform1,
  397. const double *padfGeoTransform2,
  398. double *padfGeoTransformOut);
  399. /* ==================================================================== */
  400. /* major objects (dataset, and, driver, drivermanager). */
  401. /* ==================================================================== */
  402. char CPL_DLL ** CPL_STDCALL GDALGetMetadataDomainList( GDALMajorObjectH hObject );
  403. char CPL_DLL ** CPL_STDCALL GDALGetMetadata( GDALMajorObjectH, const char * );
  404. CPLErr CPL_DLL CPL_STDCALL GDALSetMetadata( GDALMajorObjectH, char **,
  405. const char * );
  406. const char CPL_DLL * CPL_STDCALL
  407. GDALGetMetadataItem( GDALMajorObjectH, const char *, const char * );
  408. CPLErr CPL_DLL CPL_STDCALL
  409. GDALSetMetadataItem( GDALMajorObjectH, const char *, const char *,
  410. const char * );
  411. const char CPL_DLL * CPL_STDCALL GDALGetDescription( GDALMajorObjectH );
  412. void CPL_DLL CPL_STDCALL GDALSetDescription( GDALMajorObjectH, const char * );
  413. /* ==================================================================== */
  414. /* GDALDataset class ... normally this represents one file. */
  415. /* ==================================================================== */
  416. #define GDAL_DS_LAYER_CREATIONOPTIONLIST "DS_LAYER_CREATIONOPTIONLIST"
  417. GDALDriverH CPL_DLL CPL_STDCALL GDALGetDatasetDriver( GDALDatasetH );
  418. char CPL_DLL ** CPL_STDCALL GDALGetFileList( GDALDatasetH );
  419. void CPL_DLL CPL_STDCALL GDALClose( GDALDatasetH );
  420. int CPL_DLL CPL_STDCALL GDALGetRasterXSize( GDALDatasetH );
  421. int CPL_DLL CPL_STDCALL GDALGetRasterYSize( GDALDatasetH );
  422. int CPL_DLL CPL_STDCALL GDALGetRasterCount( GDALDatasetH );
  423. GDALRasterBandH CPL_DLL CPL_STDCALL GDALGetRasterBand( GDALDatasetH, int );
  424. CPLErr CPL_DLL CPL_STDCALL GDALAddBand( GDALDatasetH hDS, GDALDataType eType,
  425. char **papszOptions );
  426. GDALAsyncReaderH CPL_DLL CPL_STDCALL
  427. GDALBeginAsyncReader(GDALDatasetH hDS, int nXOff, int nYOff,
  428. int nXSize, int nYSize,
  429. void *pBuf, int nBufXSize, int nBufYSize,
  430. GDALDataType eBufType, int nBandCount, int* panBandMap,
  431. int nPixelSpace, int nLineSpace, int nBandSpace,
  432. char **papszOptions);
  433. void CPL_DLL CPL_STDCALL
  434. GDALEndAsyncReader(GDALDatasetH hDS, GDALAsyncReaderH hAsynchReaderH);
  435. CPLErr CPL_DLL CPL_STDCALL GDALDatasetRasterIO(
  436. GDALDatasetH hDS, GDALRWFlag eRWFlag,
  437. int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
  438. void * pBuffer, int nBXSize, int nBYSize, GDALDataType eBDataType,
  439. int nBandCount, int *panBandCount,
  440. int nPixelSpace, int nLineSpace, int nBandSpace);
  441. CPLErr CPL_DLL CPL_STDCALL GDALDatasetRasterIOEx(
  442. GDALDatasetH hDS, GDALRWFlag eRWFlag,
  443. int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
  444. void * pBuffer, int nBXSize, int nBYSize, GDALDataType eBDataType,
  445. int nBandCount, int *panBandCount,
  446. GSpacing nPixelSpace, GSpacing nLineSpace, GSpacing nBandSpace,
  447. GDALRasterIOExtraArg* psExtraArg);
  448. CPLErr CPL_DLL CPL_STDCALL GDALDatasetAdviseRead( GDALDatasetH hDS,
  449. int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
  450. int nBXSize, int nBYSize, GDALDataType eBDataType,
  451. int nBandCount, int *panBandCount, char **papszOptions );
  452. const char CPL_DLL * CPL_STDCALL GDALGetProjectionRef( GDALDatasetH );
  453. CPLErr CPL_DLL CPL_STDCALL GDALSetProjection( GDALDatasetH, const char * );
  454. CPLErr CPL_DLL CPL_STDCALL GDALGetGeoTransform( GDALDatasetH, double * );
  455. CPLErr CPL_DLL CPL_STDCALL GDALSetGeoTransform( GDALDatasetH, double * );
  456. int CPL_DLL CPL_STDCALL GDALGetGCPCount( GDALDatasetH );
  457. const char CPL_DLL * CPL_STDCALL GDALGetGCPProjection( GDALDatasetH );
  458. const GDAL_GCP CPL_DLL * CPL_STDCALL GDALGetGCPs( GDALDatasetH );
  459. CPLErr CPL_DLL CPL_STDCALL GDALSetGCPs( GDALDatasetH, int, const GDAL_GCP *,
  460. const char * );
  461. void CPL_DLL * CPL_STDCALL GDALGetInternalHandle( GDALDatasetH, const char * );
  462. int CPL_DLL CPL_STDCALL GDALReferenceDataset( GDALDatasetH );
  463. int CPL_DLL CPL_STDCALL GDALDereferenceDataset( GDALDatasetH );
  464. CPLErr CPL_DLL CPL_STDCALL
  465. GDALBuildOverviews( GDALDatasetH, const char *, int, int *,
  466. int, int *, GDALProgressFunc, void * );
  467. void CPL_DLL CPL_STDCALL GDALGetOpenDatasets( GDALDatasetH **hDS, int *pnCount );
  468. int CPL_DLL CPL_STDCALL GDALGetAccess( GDALDatasetH hDS );
  469. void CPL_DLL CPL_STDCALL GDALFlushCache( GDALDatasetH hDS );
  470. CPLErr CPL_DLL CPL_STDCALL
  471. GDALCreateDatasetMaskBand( GDALDatasetH hDS, int nFlags );
  472. CPLErr CPL_DLL CPL_STDCALL GDALDatasetCopyWholeRaster(
  473. GDALDatasetH hSrcDS, GDALDatasetH hDstDS, char **papszOptions,
  474. GDALProgressFunc pfnProgress, void *pProgressData );
  475. CPLErr CPL_DLL CPL_STDCALL GDALRasterBandCopyWholeRaster(
  476. GDALRasterBandH hSrcBand, GDALRasterBandH hDstBand, char **papszOptions,
  477. GDALProgressFunc pfnProgress, void *pProgressData );
  478. CPLErr CPL_DLL
  479. GDALRegenerateOverviews( GDALRasterBandH hSrcBand,
  480. int nOverviewCount, GDALRasterBandH *pahOverviewBands,
  481. const char *pszResampling,
  482. GDALProgressFunc pfnProgress, void *pProgressData );
  483. int CPL_DLL GDALDatasetGetLayerCount( GDALDatasetH );
  484. OGRLayerH CPL_DLL GDALDatasetGetLayer( GDALDatasetH, int );
  485. OGRLayerH CPL_DLL GDALDatasetGetLayerByName( GDALDatasetH, const char * );
  486. OGRErr CPL_DLL GDALDatasetDeleteLayer( GDALDatasetH, int );
  487. OGRLayerH CPL_DLL GDALDatasetCreateLayer( GDALDatasetH, const char *,
  488. OGRSpatialReferenceH, OGRwkbGeometryType,
  489. char ** );
  490. OGRLayerH CPL_DLL GDALDatasetCopyLayer( GDALDatasetH, OGRLayerH, const char *,
  491. char ** );
  492. int CPL_DLL GDALDatasetTestCapability( GDALDatasetH, const char * );
  493. OGRLayerH CPL_DLL GDALDatasetExecuteSQL( GDALDatasetH, const char *,
  494. OGRGeometryH, const char * );
  495. void CPL_DLL GDALDatasetReleaseResultSet( GDALDatasetH, OGRLayerH );
  496. OGRStyleTableH CPL_DLL GDALDatasetGetStyleTable( GDALDatasetH );
  497. void CPL_DLL GDALDatasetSetStyleTableDirectly( GDALDatasetH, OGRStyleTableH );
  498. void CPL_DLL GDALDatasetSetStyleTable( GDALDatasetH, OGRStyleTableH );
  499. OGRErr CPL_DLL GDALDatasetStartTransaction(GDALDatasetH hDS, int bForce);
  500. OGRErr CPL_DLL GDALDatasetCommitTransaction(GDALDatasetH hDS);
  501. OGRErr CPL_DLL GDALDatasetRollbackTransaction(GDALDatasetH hDS);
  502. /* ==================================================================== */
  503. /* GDALRasterBand ... one band/channel in a dataset. */
  504. /* ==================================================================== */
  505. /**
  506. * SRCVAL - Macro which may be used by pixel functions to obtain
  507. * a pixel from a source buffer.
  508. */
  509. #define SRCVAL(papoSource, eSrcType, ii) \
  510. (eSrcType == GDT_Byte ? \
  511. ((GByte *)papoSource)[ii] : \
  512. (eSrcType == GDT_Float32 ? \
  513. ((float *)papoSource)[ii] : \
  514. (eSrcType == GDT_Float64 ? \
  515. ((double *)papoSource)[ii] : \
  516. (eSrcType == GDT_Int32 ? \
  517. ((GInt32 *)papoSource)[ii] : \
  518. (eSrcType == GDT_UInt16 ? \
  519. ((GUInt16 *)papoSource)[ii] : \
  520. (eSrcType == GDT_Int16 ? \
  521. ((GInt16 *)papoSource)[ii] : \
  522. (eSrcType == GDT_UInt32 ? \
  523. ((GUInt32 *)papoSource)[ii] : \
  524. (eSrcType == GDT_CInt16 ? \
  525. ((GInt16 *)papoSource)[ii * 2] : \
  526. (eSrcType == GDT_CInt32 ? \
  527. ((GInt32 *)papoSource)[ii * 2] : \
  528. (eSrcType == GDT_CFloat32 ? \
  529. ((float *)papoSource)[ii * 2] : \
  530. (eSrcType == GDT_CFloat64 ? \
  531. ((double *)papoSource)[ii * 2] : 0)))))))))))
  532. typedef CPLErr
  533. (*GDALDerivedPixelFunc)(void **papoSources, int nSources, void *pData,
  534. int nBufXSize, int nBufYSize,
  535. GDALDataType eSrcType, GDALDataType eBufType,
  536. int nPixelSpace, int nLineSpace);
  537. GDALDataType CPL_DLL CPL_STDCALL GDALGetRasterDataType( GDALRasterBandH );
  538. void CPL_DLL CPL_STDCALL
  539. GDALGetBlockSize( GDALRasterBandH, int * pnXSize, int * pnYSize );
  540. CPLErr CPL_DLL CPL_STDCALL GDALRasterAdviseRead( GDALRasterBandH hRB,
  541. int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
  542. int nBXSize, int nBYSize, GDALDataType eBDataType, char **papszOptions );
  543. CPLErr CPL_DLL CPL_STDCALL
  544. GDALRasterIO( GDALRasterBandH hRBand, GDALRWFlag eRWFlag,
  545. int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
  546. void * pBuffer, int nBXSize, int nBYSize,GDALDataType eBDataType,
  547. int nPixelSpace, int nLineSpace );
  548. CPLErr CPL_DLL CPL_STDCALL
  549. GDALRasterIOEx( GDALRasterBandH hRBand, GDALRWFlag eRWFlag,
  550. int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
  551. void * pBuffer, int nBXSize, int nBYSize,GDALDataType eBDataType,
  552. GSpacing nPixelSpace, GSpacing nLineSpace,
  553. GDALRasterIOExtraArg* psExtraArg );
  554. CPLErr CPL_DLL CPL_STDCALL GDALReadBlock( GDALRasterBandH, int, int, void * );
  555. CPLErr CPL_DLL CPL_STDCALL GDALWriteBlock( GDALRasterBandH, int, int, void * );
  556. int CPL_DLL CPL_STDCALL GDALGetRasterBandXSize( GDALRasterBandH );
  557. int CPL_DLL CPL_STDCALL GDALGetRasterBandYSize( GDALRasterBandH );
  558. GDALAccess CPL_DLL CPL_STDCALL GDALGetRasterAccess( GDALRasterBandH );
  559. int CPL_DLL CPL_STDCALL GDALGetBandNumber( GDALRasterBandH );
  560. GDALDatasetH CPL_DLL CPL_STDCALL GDALGetBandDataset( GDALRasterBandH );
  561. GDALColorInterp CPL_DLL CPL_STDCALL
  562. GDALGetRasterColorInterpretation( GDALRasterBandH );
  563. CPLErr CPL_DLL CPL_STDCALL
  564. GDALSetRasterColorInterpretation( GDALRasterBandH, GDALColorInterp );
  565. GDALColorTableH CPL_DLL CPL_STDCALL GDALGetRasterColorTable( GDALRasterBandH );
  566. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterColorTable( GDALRasterBandH, GDALColorTableH );
  567. int CPL_DLL CPL_STDCALL GDALHasArbitraryOverviews( GDALRasterBandH );
  568. int CPL_DLL CPL_STDCALL GDALGetOverviewCount( GDALRasterBandH );
  569. GDALRasterBandH CPL_DLL CPL_STDCALL GDALGetOverview( GDALRasterBandH, int );
  570. double CPL_DLL CPL_STDCALL GDALGetRasterNoDataValue( GDALRasterBandH, int * );
  571. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterNoDataValue( GDALRasterBandH, double );
  572. char CPL_DLL ** CPL_STDCALL GDALGetRasterCategoryNames( GDALRasterBandH );
  573. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterCategoryNames( GDALRasterBandH, char ** );
  574. double CPL_DLL CPL_STDCALL GDALGetRasterMinimum( GDALRasterBandH, int *pbSuccess );
  575. double CPL_DLL CPL_STDCALL GDALGetRasterMaximum( GDALRasterBandH, int *pbSuccess );
  576. CPLErr CPL_DLL CPL_STDCALL GDALGetRasterStatistics(
  577. GDALRasterBandH, int bApproxOK, int bForce,
  578. double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev );
  579. CPLErr CPL_DLL CPL_STDCALL GDALComputeRasterStatistics(
  580. GDALRasterBandH, int bApproxOK,
  581. double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev,
  582. GDALProgressFunc pfnProgress, void *pProgressData );
  583. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterStatistics(
  584. GDALRasterBandH hBand,
  585. double dfMin, double dfMax, double dfMean, double dfStdDev );
  586. const char CPL_DLL * CPL_STDCALL GDALGetRasterUnitType( GDALRasterBandH );
  587. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterUnitType( GDALRasterBandH hBand, const char *pszNewValue );
  588. double CPL_DLL CPL_STDCALL GDALGetRasterOffset( GDALRasterBandH, int *pbSuccess );
  589. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterOffset( GDALRasterBandH hBand, double dfNewOffset);
  590. double CPL_DLL CPL_STDCALL GDALGetRasterScale( GDALRasterBandH, int *pbSuccess );
  591. CPLErr CPL_DLL CPL_STDCALL GDALSetRasterScale( GDALRasterBandH hBand, double dfNewOffset );
  592. void CPL_DLL CPL_STDCALL
  593. GDALComputeRasterMinMax( GDALRasterBandH hBand, int bApproxOK,
  594. double adfMinMax[2] );
  595. CPLErr CPL_DLL CPL_STDCALL GDALFlushRasterCache( GDALRasterBandH hBand );
  596. CPLErr CPL_DLL CPL_STDCALL GDALGetRasterHistogram( GDALRasterBandH hBand,
  597. double dfMin, double dfMax,
  598. int nBuckets, int *panHistogram,
  599. int bIncludeOutOfRange, int bApproxOK,
  600. GDALProgressFunc pfnProgress,
  601. void * pProgressData ) CPL_WARN_DEPRECATED("Use GDALGetRasterHistogramEx() instead");
  602. CPLErr CPL_DLL CPL_STDCALL GDALGetRasterHistogramEx( GDALRasterBandH hBand,
  603. double dfMin, double dfMax,
  604. int nBuckets, GUIntBig *panHistogram,
  605. int bIncludeOutOfRange, int bApproxOK,
  606. GDALProgressFunc pfnProgress,
  607. void * pProgressData );
  608. CPLErr CPL_DLL CPL_STDCALL GDALGetDefaultHistogram( GDALRasterBandH hBand,
  609. double *pdfMin, double *pdfMax,
  610. int *pnBuckets, int **ppanHistogram,
  611. int bForce,
  612. GDALProgressFunc pfnProgress,
  613. void * pProgressData ) CPL_WARN_DEPRECATED("Use GDALGetDefaultHistogramEx() instead");
  614. CPLErr CPL_DLL CPL_STDCALL GDALGetDefaultHistogramEx( GDALRasterBandH hBand,
  615. double *pdfMin, double *pdfMax,
  616. int *pnBuckets, GUIntBig **ppanHistogram,
  617. int bForce,
  618. GDALProgressFunc pfnProgress,
  619. void * pProgressData );
  620. CPLErr CPL_DLL CPL_STDCALL GDALSetDefaultHistogram( GDALRasterBandH hBand,
  621. double dfMin, double dfMax,
  622. int nBuckets, int *panHistogram ) CPL_WARN_DEPRECATED("Use GDALSetDefaultHistogramEx() instead");
  623. CPLErr CPL_DLL CPL_STDCALL GDALSetDefaultHistogramEx( GDALRasterBandH hBand,
  624. double dfMin, double dfMax,
  625. int nBuckets, GUIntBig *panHistogram );
  626. int CPL_DLL CPL_STDCALL
  627. GDALGetRandomRasterSample( GDALRasterBandH, int, float * );
  628. GDALRasterBandH CPL_DLL CPL_STDCALL
  629. GDALGetRasterSampleOverview( GDALRasterBandH, int );
  630. GDALRasterBandH CPL_DLL CPL_STDCALL
  631. GDALGetRasterSampleOverviewEx( GDALRasterBandH, GUIntBig );
  632. CPLErr CPL_DLL CPL_STDCALL GDALFillRaster( GDALRasterBandH hBand,
  633. double dfRealValue, double dfImaginaryValue );
  634. CPLErr CPL_DLL CPL_STDCALL
  635. GDALComputeBandStats( GDALRasterBandH hBand, int nSampleStep,
  636. double *pdfMean, double *pdfStdDev,
  637. GDALProgressFunc pfnProgress,
  638. void *pProgressData );
  639. CPLErr CPL_DLL GDALOverviewMagnitudeCorrection( GDALRasterBandH hBaseBand,
  640. int nOverviewCount,
  641. GDALRasterBandH *pahOverviews,
  642. GDALProgressFunc pfnProgress,
  643. void *pProgressData );
  644. GDALRasterAttributeTableH CPL_DLL CPL_STDCALL GDALGetDefaultRAT(
  645. GDALRasterBandH hBand );
  646. CPLErr CPL_DLL CPL_STDCALL GDALSetDefaultRAT( GDALRasterBandH,
  647. GDALRasterAttributeTableH );
  648. CPLErr CPL_DLL CPL_STDCALL GDALAddDerivedBandPixelFunc( const char *pszName,
  649. GDALDerivedPixelFunc pfnPixelFunc );
  650. GDALRasterBandH CPL_DLL CPL_STDCALL GDALGetMaskBand( GDALRasterBandH hBand );
  651. int CPL_DLL CPL_STDCALL GDALGetMaskFlags( GDALRasterBandH hBand );
  652. CPLErr CPL_DLL CPL_STDCALL
  653. GDALCreateMaskBand( GDALRasterBandH hBand, int nFlags );
  654. #define GMF_ALL_VALID 0x01
  655. #define GMF_PER_DATASET 0x02
  656. #define GMF_ALPHA 0x04
  657. #define GMF_NODATA 0x08
  658. /* ==================================================================== */
  659. /* GDALAsyncReader */
  660. /* ==================================================================== */
  661. GDALAsyncStatusType CPL_DLL CPL_STDCALL
  662. GDALARGetNextUpdatedRegion(GDALAsyncReaderH hARIO, double dfTimeout,
  663. int* pnXBufOff, int* pnYBufOff,
  664. int* pnXBufSize, int* pnYBufSize );
  665. int CPL_DLL CPL_STDCALL GDALARLockBuffer(GDALAsyncReaderH hARIO,
  666. double dfTimeout);
  667. void CPL_DLL CPL_STDCALL GDALARUnlockBuffer(GDALAsyncReaderH hARIO);
  668. /* -------------------------------------------------------------------- */
  669. /* Helper functions. */
  670. /* -------------------------------------------------------------------- */
  671. int CPL_DLL CPL_STDCALL GDALGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv,
  672. int nOptions );
  673. void CPL_DLL CPL_STDCALL GDALSwapWords( void *pData, int nWordSize, int nWordCount,
  674. int nWordSkip );
  675. void CPL_DLL CPL_STDCALL
  676. GDALCopyWords( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset,
  677. void * pDstData, GDALDataType eDstType, int nDstPixelOffset,
  678. int nWordCount );
  679. void CPL_DLL
  680. GDALCopyBits( const GByte *pabySrcData, int nSrcOffset, int nSrcStep,
  681. GByte *pabyDstData, int nDstOffset, int nDstStep,
  682. int nBitCount, int nStepCount );
  683. int CPL_DLL CPL_STDCALL GDALLoadWorldFile( const char *, double * );
  684. int CPL_DLL CPL_STDCALL GDALReadWorldFile( const char *, const char *,
  685. double * );
  686. int CPL_DLL CPL_STDCALL GDALWriteWorldFile( const char *, const char *,
  687. double * );
  688. int CPL_DLL CPL_STDCALL GDALLoadTabFile( const char *, double *, char **,
  689. int *, GDAL_GCP ** );
  690. int CPL_DLL CPL_STDCALL GDALReadTabFile( const char *, double *, char **,
  691. int *, GDAL_GCP ** );
  692. int CPL_DLL CPL_STDCALL GDALLoadOziMapFile( const char *, double *, char **,
  693. int *, GDAL_GCP ** );
  694. int CPL_DLL CPL_STDCALL GDALReadOziMapFile( const char * , double *,
  695. char **, int *, GDAL_GCP ** );
  696. const char CPL_DLL * CPL_STDCALL GDALDecToDMS( double, const char *, int );
  697. double CPL_DLL CPL_STDCALL GDALPackedDMSToDec( double );
  698. double CPL_DLL CPL_STDCALL GDALDecToPackedDMS( double );
  699. /* Note to developers : please keep this section in sync with ogr_core.h */
  700. #ifndef GDAL_VERSION_INFO_DEFINED
  701. #define GDAL_VERSION_INFO_DEFINED
  702. const char CPL_DLL * CPL_STDCALL GDALVersionInfo( const char * );
  703. #endif
  704. #ifndef GDAL_CHECK_VERSION
  705. int CPL_DLL CPL_STDCALL GDALCheckVersion( int nVersionMajor, int nVersionMinor,
  706. const char* pszCallingComponentName);
  707. /** Helper macro for GDALCheckVersion()
  708. @see GDALCheckVersion()
  709. */
  710. #define GDAL_CHECK_VERSION(pszCallingComponentName) \
  711. GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, pszCallingComponentName)
  712. #endif
  713. typedef struct {
  714. double dfLINE_OFF;
  715. double dfSAMP_OFF;
  716. double dfLAT_OFF;
  717. double dfLONG_OFF;
  718. double dfHEIGHT_OFF;
  719. double dfLINE_SCALE;
  720. double dfSAMP_SCALE;
  721. double dfLAT_SCALE;
  722. double dfLONG_SCALE;
  723. double dfHEIGHT_SCALE;
  724. double adfLINE_NUM_COEFF[20];
  725. double adfLINE_DEN_COEFF[20];
  726. double adfSAMP_NUM_COEFF[20];
  727. double adfSAMP_DEN_COEFF[20];
  728. double dfMIN_LONG;
  729. double dfMIN_LAT;
  730. double dfMAX_LONG;
  731. double dfMAX_LAT;
  732. } GDALRPCInfo;
  733. int CPL_DLL CPL_STDCALL GDALExtractRPCInfo( char **, GDALRPCInfo * );
  734. /* ==================================================================== */
  735. /* Color tables. */
  736. /* ==================================================================== */
  737. /** Color tuple */
  738. typedef struct
  739. {
  740. /*! gray, red, cyan or hue */
  741. short c1;
  742. /*! green, magenta, or lightness */
  743. short c2;
  744. /*! blue, yellow, or saturation */
  745. short c3;
  746. /*! alpha or blackband */
  747. short c4;
  748. } GDALColorEntry;
  749. GDALColorTableH CPL_DLL CPL_STDCALL GDALCreateColorTable( GDALPaletteInterp );
  750. void CPL_DLL CPL_STDCALL GDALDestroyColorTable( GDALColorTableH );
  751. GDALColorTableH CPL_DLL CPL_STDCALL GDALCloneColorTable( GDALColorTableH );
  752. GDALPaletteInterp CPL_DLL CPL_STDCALL GDALGetPaletteInterpretation( GDALColorTableH );
  753. int CPL_DLL CPL_STDCALL GDALGetColorEntryCount( GDALColorTableH );
  754. const GDALColorEntry CPL_DLL * CPL_STDCALL GDALGetColorEntry( GDALColorTableH, int );
  755. int CPL_DLL CPL_STDCALL GDALGetColorEntryAsRGB( GDALColorTableH, int, GDALColorEntry *);
  756. void CPL_DLL CPL_STDCALL GDALSetColorEntry( GDALColorTableH, int, const GDALColorEntry * );
  757. void CPL_DLL CPL_STDCALL GDALCreateColorRamp( GDALColorTableH hTable,
  758. int nStartIndex, const GDALColorEntry *psStartColor,
  759. int nEndIndex, const GDALColorEntry *psEndColor );
  760. /* ==================================================================== */
  761. /* Raster Attribute Table */
  762. /* ==================================================================== */
  763. /** Field type of raster attribute table */
  764. typedef enum {
  765. /*! Integer field */ GFT_Integer ,
  766. /*! Floating point (double) field */ GFT_Real,
  767. /*! String field */ GFT_String
  768. } GDALRATFieldType;
  769. /** Field usage of raster attribute table */
  770. typedef enum {
  771. /*! General purpose field. */ GFU_Generic = 0,
  772. /*! Histogram pixel count */ GFU_PixelCount = 1,
  773. /*! Class name */ GFU_Name = 2,
  774. /*! Class range minimum */ GFU_Min = 3,
  775. /*! Class range maximum */ GFU_Max = 4,
  776. /*! Class value (min=max) */ GFU_MinMax = 5,
  777. /*! Red class color (0-255) */ GFU_Red = 6,
  778. /*! Green class color (0-255) */ GFU_Green = 7,
  779. /*! Blue class color (0-255) */ GFU_Blue = 8,
  780. /*! Alpha (0=transparent,255=opaque)*/ GFU_Alpha = 9,
  781. /*! Color Range Red Minimum */ GFU_RedMin = 10,
  782. /*! Color Range Green Minimum */ GFU_GreenMin = 11,
  783. /*! Color Range Blue Minimum */ GFU_BlueMin = 12,
  784. /*! Color Range Alpha Minimum */ GFU_AlphaMin = 13,
  785. /*! Color Range Red Maximum */ GFU_RedMax = 14,
  786. /*! Color Range Green Maximum */ GFU_GreenMax = 15,
  787. /*! Color Range Blue Maximum */ GFU_BlueMax = 16,
  788. /*! Color Range Alpha Maximum */ GFU_AlphaMax = 17,
  789. /*! Maximum GFU value */ GFU_MaxCount
  790. } GDALRATFieldUsage;
  791. GDALRasterAttributeTableH CPL_DLL CPL_STDCALL
  792. GDALCreateRasterAttributeTable(void);
  793. void CPL_DLL CPL_STDCALL GDALDestroyRasterAttributeTable(
  794. GDALRasterAttributeTableH );
  795. int CPL_DLL CPL_STDCALL GDALRATGetColumnCount( GDALRasterAttributeTableH );
  796. const char CPL_DLL * CPL_STDCALL GDALRATGetNameOfCol(
  797. GDALRasterAttributeTableH, int );
  798. GDALRATFieldUsage CPL_DLL CPL_STDCALL GDALRATGetUsageOfCol(
  799. GDALRasterAttributeTableH, int );
  800. GDALRATFieldType CPL_DLL CPL_STDCALL GDALRATGetTypeOfCol(
  801. GDALRasterAttributeTableH, int );
  802. int CPL_DLL CPL_STDCALL GDALRATGetColOfUsage( GDALRasterAttributeTableH,
  803. GDALRATFieldUsage );
  804. int CPL_DLL CPL_STDCALL GDALRATGetRowCount( GDALRasterAttributeTableH );
  805. const char CPL_DLL * CPL_STDCALL GDALRATGetValueAsString(
  806. GDALRasterAttributeTableH, int ,int);
  807. int CPL_DLL CPL_STDCALL GDALRATGetValueAsInt(
  808. GDALRasterAttributeTableH, int ,int);
  809. double CPL_DLL CPL_STDCALL GDALRATGetValueAsDouble(
  810. GDALRasterAttributeTableH, int ,int);
  811. void CPL_DLL CPL_STDCALL GDALRATSetValueAsString( GDALRasterAttributeTableH, int, int,
  812. const char * );
  813. void CPL_DLL CPL_STDCALL GDALRATSetValueAsInt( GDALRasterAttributeTableH, int, int,
  814. int );
  815. void CPL_DLL CPL_STDCALL GDALRATSetValueAsDouble( GDALRasterAttributeTableH, int, int,
  816. double );
  817. int CPL_DLL CPL_STDCALL GDALRATChangesAreWrittenToFile( GDALRasterAttributeTableH hRAT );
  818. CPLErr CPL_DLL CPL_STDCALL GDALRATValuesIOAsDouble( GDALRasterAttributeTableH hRAT, GDALRWFlag eRWFlag,
  819. int iField, int iStartRow, int iLength, double *pdfData );
  820. CPLErr CPL_DLL CPL_STDCALL GDALRATValuesIOAsInteger( GDALRasterAttributeTableH hRAT, GDALRWFlag eRWFlag,
  821. int iField, int iStartRow, int iLength, int *pnData);
  822. CPLErr CPL_DLL CPL_STDCALL GDALRATValuesIOAsString( GDALRasterAttributeTableH hRAT, GDALRWFlag eRWFlag,
  823. int iField, int iStartRow, int iLength, char **papszStrList);
  824. void CPL_DLL CPL_STDCALL GDALRATSetRowCount( GDALRasterAttributeTableH,
  825. int );
  826. CPLErr CPL_DLL CPL_STDCALL GDALRATCreateColumn( GDALRasterAttributeTableH,
  827. const char *,
  828. GDALRATFieldType,
  829. GDALRATFieldUsage );
  830. CPLErr CPL_DLL CPL_STDCALL GDALRATSetLinearBinning( GDALRasterAttributeTableH,
  831. double, double );
  832. int CPL_DLL CPL_STDCALL GDALRATGetLinearBinning( GDALRasterAttributeTableH,
  833. double *, double * );
  834. CPLErr CPL_DLL CPL_STDCALL GDALRATInitializeFromColorTable(
  835. GDALRasterAttributeTableH, GDALColorTableH );
  836. GDALColorTableH CPL_DLL CPL_STDCALL GDALRATTranslateToColorTable(
  837. GDALRasterAttributeTableH, int nEntryCount );
  838. void CPL_DLL CPL_STDCALL GDALRATDumpReadable( GDALRasterAttributeTableH,
  839. FILE * );
  840. GDALRasterAttributeTableH CPL_DLL CPL_STDCALL
  841. GDALRATClone( GDALRasterAttributeTableH );
  842. void CPL_DLL* CPL_STDCALL
  843. GDALRATSerializeJSON( GDALRasterAttributeTableH );
  844. int CPL_DLL CPL_STDCALL GDALRATGetRowOfValue( GDALRasterAttributeTableH , double );
  845. /* ==================================================================== */
  846. /* GDAL Cache Management */
  847. /* ==================================================================== */
  848. void CPL_DLL CPL_STDCALL GDALSetCacheMax( int nBytes );
  849. int CPL_DLL CPL_STDCALL GDALGetCacheMax(void);
  850. int CPL_DLL CPL_STDCALL GDALGetCacheUsed(void);
  851. void CPL_DLL CPL_STDCALL GDALSetCacheMax64( GIntBig nBytes );
  852. GIntBig CPL_DLL CPL_STDCALL GDALGetCacheMax64(void);
  853. GIntBig CPL_DLL CPL_STDCALL GDALGetCacheUsed64(void);
  854. int CPL_DLL CPL_STDCALL GDALFlushCacheBlock(void);
  855. /* ==================================================================== */
  856. /* GDAL virtual memory */
  857. /* ==================================================================== */
  858. CPLVirtualMem CPL_DLL* GDALDatasetGetVirtualMem( GDALDatasetH hDS,
  859. GDALRWFlag eRWFlag,
  860. int nXOff, int nYOff,
  861. int nXSize, int nYSize,
  862. int nBufXSize, int nBufYSize,
  863. GDALDataType eBufType,
  864. int nBandCount, int* panBandMap,
  865. int nPixelSpace,
  866. GIntBig nLineSpace,
  867. GIntBig nBandSpace,
  868. size_t nCacheSize,
  869. size_t nPageSizeHint,
  870. int bSingleThreadUsage,
  871. char **papszOptions );
  872. CPLVirtualMem CPL_DLL* GDALRasterBandGetVirtualMem( GDALRasterBandH hBand,
  873. GDALRWFlag eRWFlag,
  874. int nXOff, int nYOff,
  875. int nXSize, int nYSize,
  876. int nBufXSize, int nBufYSize,
  877. GDALDataType eBufType,
  878. int nPixelSpace,
  879. GIntBig nLineSpace,
  880. size_t nCacheSize,
  881. size_t nPageSizeHint,
  882. int bSingleThreadUsage,
  883. char **papszOptions );
  884. CPLVirtualMem CPL_DLL* GDALGetVirtualMemAuto( GDALRasterBandH hBand,
  885. GDALRWFlag eRWFlag,
  886. int *pnPixelSpace,
  887. GIntBig *pnLineSpace,
  888. char **papszOptions );
  889. typedef enum
  890. {
  891. /*! Tile Interleaved by Pixel: tile (0,0) with internal band interleaved by pixel organization, tile (1, 0), ... */
  892. GTO_TIP,
  893. /*! Band Interleaved by Tile : tile (0,0) of first band, tile (0,0) of second band, ... tile (1,0) of fisrt band, tile (1,0) of second band, ... */
  894. GTO_BIT,
  895. /*! Band SeQuential : all the tiles of first band, all the tiles of following band... */
  896. GTO_BSQ
  897. } GDALTileOrganization;
  898. CPLVirtualMem CPL_DLL* GDALDatasetGetTiledVirtualMem( GDALDatasetH hDS,
  899. GDALRWFlag eRWFlag,
  900. int nXOff, int nYOff,
  901. int nXSize, int nYSize,
  902. int nTileXSize, int nTileYSize,
  903. GDALDataType eBufType,
  904. int nBandCount, int* panBandMap,
  905. GDALTileOrganization eTileOrganization,
  906. size_t nCacheSize,
  907. int bSingleThreadUsage,
  908. char **papszOptions );
  909. CPLVirtualMem CPL_DLL* GDALRasterBandGetTiledVirtualMem( GDALRasterBandH hBand,
  910. GDALRWFlag eRWFlag,
  911. int nXOff, int nYOff,
  912. int nXSize, int nYSize,
  913. int nTileXSize, int nTileYSize,
  914. GDALDataType eBufType,
  915. size_t nCacheSize,
  916. int bSingleThreadUsage,
  917. char **papszOptions );
  918. /* =================================================================== */
  919. /* Misc API */
  920. /* ==================================================================== */
  921. CPLXMLNode CPL_DLL* GDALGetJPEG2000Structure(const char* pszFilename,
  922. char** papszOptions);
  923. CPL_C_END
  924. #endif /* ndef GDAL_H_INCLUDED */