GDAL
gdal_alg.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: gdal_alg.h 22655 2011-07-06 18:29:28Z rouault $
3  *
4  * Project: GDAL Image Processing Algorithms
5  * Purpose: Prototypes, and definitions for various GDAL based algorithms.
6  * Author: Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2001, Frank Warmerdam
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #ifndef GDAL_ALG_H_INCLUDED
31 #define GDAL_ALG_H_INCLUDED
32 
39 #ifndef DOXYGEN_SKIP
40 #include "gdal.h"
41 #include "cpl_minixml.h"
42 #include "ogr_api.h"
43 #endif
44 
45 CPL_C_START
46 
47 int CPL_DLL CPL_STDCALL GDALComputeMedianCutPCT( GDALRasterBandH hRed,
48  GDALRasterBandH hGreen,
49  GDALRasterBandH hBlue,
50  int (*pfnIncludePixel)(int,int,void*),
51  int nColors,
52  GDALColorTableH hColorTable,
53  GDALProgressFunc pfnProgress,
54  void * pProgressArg );
55 
56 int CPL_DLL CPL_STDCALL GDALDitherRGB2PCT( GDALRasterBandH hRed,
57  GDALRasterBandH hGreen,
58  GDALRasterBandH hBlue,
59  GDALRasterBandH hTarget,
60  GDALColorTableH hColorTable,
61  GDALProgressFunc pfnProgress,
62  void * pProgressArg );
63 
64 int CPL_DLL CPL_STDCALL GDALChecksumImage( GDALRasterBandH hBand,
65  int nXOff, int nYOff, int nXSize, int nYSize );
66 
67 CPLErr CPL_DLL CPL_STDCALL
69  GDALRasterBandH hProximityBand,
70  char **papszOptions,
71  GDALProgressFunc pfnProgress,
72  void * pProgressArg );
73 
74 CPLErr CPL_DLL CPL_STDCALL
75 GDALFillNodata( GDALRasterBandH hTargetBand,
76  GDALRasterBandH hMaskBand,
77  double dfMaxSearchDist,
78  int bDeprecatedOption,
79  int nSmoothingIterations,
80  char **papszOptions,
81  GDALProgressFunc pfnProgress,
82  void * pProgressArg );
83 
84 CPLErr CPL_DLL CPL_STDCALL
86  GDALRasterBandH hMaskBand,
87  OGRLayerH hOutLayer, int iPixValField,
88  char **papszOptions,
89  GDALProgressFunc pfnProgress,
90  void * pProgressArg );
91 
92 CPLErr CPL_DLL CPL_STDCALL
93 GDALFPolygonize( GDALRasterBandH hSrcBand,
94  GDALRasterBandH hMaskBand,
95  OGRLayerH hOutLayer, int iPixValField,
96  char **papszOptions,
97  GDALProgressFunc pfnProgress,
98  void * pProgressArg );
99 
100 CPLErr CPL_DLL CPL_STDCALL
101 GDALSieveFilter( GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand,
102  GDALRasterBandH hDstBand,
103  int nSizeThreshold, int nConnectedness,
104  char **papszOptions,
105  GDALProgressFunc pfnProgress,
106  void * pProgressArg );
107 
108 /*
109  * Warp Related.
110  */
111 
112 typedef int
113 (*GDALTransformerFunc)( void *pTransformerArg,
114  int bDstToSrc, int nPointCount,
115  double *x, double *y, double *z, int *panSuccess );
116 
117 typedef struct {
118  char szSignature[4];
119  const char *pszClassName;
120  GDALTransformerFunc pfnTransform;
121  void (*pfnCleanup)( void * );
122  CPLXMLNode *(*pfnSerialize)( void * );
124 
125 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg );
126 int CPL_DLL GDALUseTransformer( void *pTranformerArg,
127  int bDstToSrc, int nPointCount,
128  double *x, double *y, double *z,
129  int *panSuccess );
130 
131 /* High level transformer for going from image coordinates on one file
132  to image coordiantes on another, potentially doing reprojection,
133  utilizing GCPs or using the geotransform. */
134 
135 void CPL_DLL *
136 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT,
137  GDALDatasetH hDstDS, const char *pszDstWKT,
138  int bGCPUseOK, double dfGCPErrorThreshold,
139  int nOrder );
140 void CPL_DLL *
142  char **papszOptions );
143 void CPL_DLL *
144 GDALCreateGenImgProjTransformer3( const char *pszSrcWKT,
145  const double *padfSrcGeoTransform,
146  const char *pszDstWKT,
147  const double *padfDstGeoTransform );
148 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *,
149  const double * );
150 void CPL_DLL GDALDestroyGenImgProjTransformer( void * );
151 int CPL_DLL GDALGenImgProjTransform(
152  void *pTransformArg, int bDstToSrc, int nPointCount,
153  double *x, double *y, double *z, int *panSuccess );
154 
155 /* Geo to geo reprojection transformer. */
156 void CPL_DLL *
157 GDALCreateReprojectionTransformer( const char *pszSrcWKT,
158  const char *pszDstWKT );
159 void CPL_DLL GDALDestroyReprojectionTransformer( void * );
160 int CPL_DLL GDALReprojectionTransform(
161  void *pTransformArg, int bDstToSrc, int nPointCount,
162  double *x, double *y, double *z, int *panSuccess );
163 
164 /* GCP based transformer ... forward is to georef coordinates */
165 void CPL_DLL *
166 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList,
167  int nReqOrder, int bReversed );
168 
169 /* GCP based transformer with refinement of the GCPs ... forward is to georef coordinates */
170 void CPL_DLL *
171 GDALCreateGCPRefineTransformer( int nGCPCount, const GDAL_GCP *pasGCPList,
172  int nReqOrder, int bReversed, double tolerance, int minimumGcps);
173 
174 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg );
175 int CPL_DLL GDALGCPTransform(
176  void *pTransformArg, int bDstToSrc, int nPointCount,
177  double *x, double *y, double *z, int *panSuccess );
178 
179 /* Thin Plate Spine transformer ... forward is to georef coordinates */
180 
181 void CPL_DLL *
182 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList,
183  int bReversed );
184 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg );
185 int CPL_DLL GDALTPSTransform(
186  void *pTransformArg, int bDstToSrc, int nPointCount,
187  double *x, double *y, double *z, int *panSuccess );
188 
189 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */
190 
191 void CPL_DLL *
192 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed,
193  double dfPixErrThreshold,
194  char **papszOptions );
195 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg );
196 int CPL_DLL GDALRPCTransform(
197  void *pTransformArg, int bDstToSrc, int nPointCount,
198  double *x, double *y, double *z, int *panSuccess );
199 
200 /* Geolocation transformer */
201 
202 void CPL_DLL *
203 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS,
204  char **papszGeolocationInfo,
205  int bReversed );
206 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg );
207 int CPL_DLL GDALGeoLocTransform(
208  void *pTransformArg, int bDstToSrc, int nPointCount,
209  double *x, double *y, double *z, int *panSuccess );
210 
211 /* Approximate transformer */
212 void CPL_DLL *
214  void *pRawTransformerArg, double dfMaxError );
215 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData,
216  int bOwnFlag );
217 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg );
218 int CPL_DLL GDALApproxTransform(
219  void *pTransformArg, int bDstToSrc, int nPointCount,
220  double *x, double *y, double *z, int *panSuccess );
221 
222 
223 
224 
225 int CPL_DLL CPL_STDCALL
227  GDALDatasetH hDstDS,
228  int nBandCount, int *panBandList,
229  GDALTransformerFunc pfnTransform,
230  void *pTransformArg,
231  GDALProgressFunc pfnProgress,
232  void *pProgressArg,
233  char **papszWarpOptions );
234 
235 CPLErr CPL_DLL CPL_STDCALL
237  GDALTransformerFunc pfnTransformer,
238  void *pTransformArg,
239  double *padfGeoTransformOut,
240  int *pnPixels, int *pnLines );
241 CPLErr CPL_DLL CPL_STDCALL
243  GDALTransformerFunc pfnTransformer,
244  void *pTransformArg,
245  double *padfGeoTransformOut,
246  int *pnPixels, int *pnLines,
247  double *padfExtents,
248  int nOptions );
249 
250 CPLXMLNode CPL_DLL *
251 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg );
252 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree,
253  GDALTransformerFunc *ppfnFunc,
254  void **ppTransformArg );
255 
256 
257 /* -------------------------------------------------------------------- */
258 /* Contour Line Generation */
259 /* -------------------------------------------------------------------- */
260 
261 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints,
262  double *padfX, double *padfY, void * );
263 
264 typedef void *GDALContourGeneratorH;
265 
266 GDALContourGeneratorH CPL_DLL
267 GDAL_CG_Create( int nWidth, int nHeight,
268  int bNoDataSet, double dfNoDataValue,
269  double dfContourInterval, double dfContourBase,
270  GDALContourWriter pfnWriter, void *pCBData );
271 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG,
272  double *padfScanline );
273 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG );
274 
275 typedef struct
276 {
277  void *hLayer;
278 
279  double adfGeoTransform[6];
280 
281  int nElevField;
282  int nIDField;
283  int nNextID;
285 
286 CPLErr CPL_DLL
287 OGRContourWriter( double, int, double *, double *, void *pInfo );
288 
289 CPLErr CPL_DLL
290 GDALContourGenerate( GDALRasterBandH hBand,
291  double dfContourInterval, double dfContourBase,
292  int nFixedLevelCount, double *padfFixedLevels,
293  int bUseNoData, double dfNoDataValue,
294  void *hLayer, int iIDField, int iElevField,
295  GDALProgressFunc pfnProgress, void *pProgressArg );
296 
297 /************************************************************************/
298 /* Rasterizer API - geometries burned into GDAL raster. */
299 /************************************************************************/
300 
301 CPLErr CPL_DLL
303  int nBandCount, int *panBandList,
304  int nGeomCount, OGRGeometryH *pahGeometries,
305  GDALTransformerFunc pfnTransformer,
306  void *pTransformArg,
307  double *padfGeomBurnValue,
308  char **papszOptions,
309  GDALProgressFunc pfnProgress,
310  void * pProgressArg );
311 CPLErr CPL_DLL
313  int nBandCount, int *panBandList,
314  int nLayerCount, OGRLayerH *pahLayers,
315  GDALTransformerFunc pfnTransformer,
316  void *pTransformArg,
317  double *padfLayerBurnValues,
318  char **papszOptions,
319  GDALProgressFunc pfnProgress,
320  void *pProgressArg );
321 
322 CPLErr CPL_DLL
323 GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize,
324  GDALDataType eBufType, int nPixelSpace, int nLineSpace,
325  int nLayerCount, OGRLayerH *pahLayers,
326  const char *pszDstProjection,
327  double *padfDstGeoTransform,
328  GDALTransformerFunc pfnTransformer,
329  void *pTransformArg, double dfBurnValue,
330  char **papszOptions, GDALProgressFunc pfnProgress,
331  void *pProgressArg );
332 
333 
334 /************************************************************************/
335 /* Gridding interface. */
336 /************************************************************************/
337 
351 
353 typedef struct
354 {
356  double dfPower;
358  double dfSmoothing;
364  double dfRadius1;
366  double dfRadius2;
371  double dfAngle;
378  GUInt32 nMaxPoints;
384  GUInt32 nMinPoints;
388 
390 typedef struct
391 {
393  double dfRadius1;
395  double dfRadius2;
400  double dfAngle;
406  GUInt32 nMinPoints;
410 
412 typedef struct
413 {
415  double dfRadius1;
417  double dfRadius2;
422  double dfAngle;
426 
428 typedef struct
429 {
431  double dfRadius1;
433  double dfRadius2;
438  double dfAngle;
444  GUInt32 nMinPoints;
448 
449 CPLErr CPL_DLL
450 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32,
451  const double *, const double *, const double *,
452  double, double, double, double,
453  GUInt32, GUInt32, GDALDataType, void *,
454  GDALProgressFunc, void *);
455 CPL_C_END
456 
457 #endif /* ndef GDAL_ALG_H_INCLUDED */

Generated for GDAL by doxygen 1.8.1.