1
2
3
4
5
6
7
8
9
10
11 from sys import version_info
12 if version_info >= (2, 6, 0):
14 from os.path import dirname
15 import imp
16 fp = None
17 try:
18 fp, pathname, description = imp.find_module('_gdal', [dirname(__file__)])
19 except ImportError:
20 import _gdal
21 return _gdal
22 if fp is not None:
23 try:
24 _mod = imp.load_module('_gdal', fp, pathname, description)
25 finally:
26 fp.close()
27 return _mod
28 _gdal = swig_import_helper()
29 del swig_import_helper
30 else:
31 import _gdal
32 del version_info
33 try:
34 _swig_property = property
35 except NameError:
36 pass
37
38
40 if (name == "thisown"):
41 return self.this.own(value)
42 if (name == "this"):
43 if type(value).__name__ == 'SwigPyObject':
44 self.__dict__[name] = value
45 return
46 method = class_type.__swig_setmethods__.get(name, None)
47 if method:
48 return method(self, value)
49 if (not static):
50 if _newclass:
51 object.__setattr__(self, name, value)
52 else:
53 self.__dict__[name] = value
54 else:
55 raise AttributeError("You cannot add attributes to %s" % self)
56
57
60
61
63 if (name == "thisown"):
64 return self.this.own()
65 method = class_type.__swig_getmethods__.get(name, None)
66 if method:
67 return method(self)
68 if (not static):
69 return object.__getattr__(self, name)
70 else:
71 raise AttributeError(name)
72
75
76
78 try:
79 strthis = "proxy of " + self.this.__repr__()
80 except Exception:
81 strthis = ""
82 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
83
84 try:
85 _object = object
86 _newclass = 1
87 except AttributeError:
90 _newclass = 0
91
92
93
94
95
96 have_warned = 0
98 global have_warned
99
100 if have_warned == 1:
101 return
102
103 have_warned = 1
104
105 from warnings import warn
106 warn('%s.py was placed in a namespace, it is now available as osgeo.%s' % (module,module),
107 DeprecationWarning)
108
109
110 from gdalconst import *
111 import gdalconst
112
113
114 import sys
115 byteorders = {"little": "<",
116 "big": ">"}
117 array_modes = { gdalconst.GDT_Int16: ("%si2" % byteorders[sys.byteorder]),
118 gdalconst.GDT_UInt16: ("%su2" % byteorders[sys.byteorder]),
119 gdalconst.GDT_Int32: ("%si4" % byteorders[sys.byteorder]),
120 gdalconst.GDT_UInt32: ("%su4" % byteorders[sys.byteorder]),
121 gdalconst.GDT_Float32: ("%sf4" % byteorders[sys.byteorder]),
122 gdalconst.GDT_Float64: ("%sf8" % byteorders[sys.byteorder]),
123 gdalconst.GDT_CFloat32: ("%sf4" % byteorders[sys.byteorder]),
124 gdalconst.GDT_CFloat64: ("%sf8" % byteorders[sys.byteorder]),
125 gdalconst.GDT_Byte: ("%st8" % byteorders[sys.byteorder]),
126 }
127
129 src_ds = Open(src_filename)
130 if src_ds is None or src_ds == 'NULL':
131 return 1
132
133 ct = ColorTable()
134 err = ComputeMedianCutPCT( src_ds.GetRasterBand(1),
135 src_ds.GetRasterBand(2),
136 src_ds.GetRasterBand(3),
137 256, ct )
138 if err != 0:
139 return err
140
141 gtiff_driver = GetDriverByName('GTiff')
142 if gtiff_driver is None:
143 return 1
144
145 dst_ds = gtiff_driver.Create( dst_filename,
146 src_ds.RasterXSize, src_ds.RasterYSize )
147 dst_ds.GetRasterBand(1).SetRasterColorTable( ct )
148
149 err = DitherRGB2PCT( src_ds.GetRasterBand(1),
150 src_ds.GetRasterBand(2),
151 src_ds.GetRasterBand(3),
152 dst_ds.GetRasterBand(1),
153 ct )
154 dst_ds = None
155 src_ds = None
156
157 return 0
158
159
163
167
171
173 """VSIFReadL(unsigned int nMembSize, unsigned int nMembCount, VSILFILE * fp) -> unsigned int"""
174 return _gdal.VSIFReadL(*args)
175
176
178 return isinstance(o, str) or str(type(o)) == "<type 'unicode'>"
179
180 -def InfoOptions(options = [], format = 'text', deserialize = True,
181 computeMinMax = False, reportHistograms = False, reportProj4 = False,
182 stats = False, approxStats = False, computeChecksum = False,
183 showGCPs = True, showMetadata = True, showRAT = True, showColorTable = True,
184 listMDD = False, showFileList = True, allMetadata = False,
185 extraMDDomains = None):
186 """ Create a InfoOptions() object that can be passed to gdal.Info()
187 options can be be an array of strings, a string or let empty and filled from other keywords."""
188 import copy
189
190 if _is_str_or_unicode(options):
191 new_options = ParseCommandLine(options)
192 format = 'text'
193 if '-json' in new_options:
194 format = 'json'
195 else:
196 new_options = copy.copy(options)
197 if format == 'json':
198 new_options += ['-json']
199 if computeMinMax:
200 new_options += ['-mm']
201 if reportHistograms:
202 new_options += ['-hist']
203 if reportProj4:
204 new_options += ['-proj4']
205 if stats:
206 new_options += ['-stats']
207 if approxStats:
208 new_options += ['-approx_stats']
209 if computeChecksum:
210 new_options += ['-checksum']
211 if not showGCPs:
212 new_options += ['-nogcp']
213 if not showMetadata:
214 new_options += ['-nomd']
215 if not showRAT:
216 new_options += ['-norat']
217 if not showColorTable:
218 new_options += ['-noct']
219 if listMDD:
220 new_options += ['-listmdd']
221 if not showFileList:
222 new_options += ['-nofl']
223 if allMetadata:
224 new_options += ['-mdd', 'all']
225 if extraMDDomains is not None:
226 for mdd in extraMDDomains:
227 new_options += ['-mdd', mdd]
228
229 return (GDALInfoOptions(new_options), format, deserialize)
230
231 -def Info(ds, **kwargs):
232 """ Return information on a dataset.
233 Arguments are :
234 ds --- a Dataset object or a filename
235 Keyword arguments are :
236 options --- return of gdal.InfoOptions(), string or array of strings
237 other keywords arguments of gdal.InfoOptions()
238 If options is provided as a gdal.InfoOptions() object, other keywords are ignored. """
239 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
240 (opts, format, deserialize) = InfoOptions(**kwargs)
241 else:
242 (opts, format, deserialize) = kwargs['options']
243 if _is_str_or_unicode(ds):
244 ds = Open(ds)
245 ret = InfoInternal(ds, opts)
246 if format == 'json' and deserialize:
247 import json
248 ret = json.loads(ret)
249 return ret
250
253
254 -def TranslateOptions(options = [], format = None,
255 outputType = GDT_Unknown, bandList = None, maskBand = None,
256 width = 0, height = 0, widthPct = 0.0, heightPct = 0.0,
257 xRes = 0.0, yRes = 0.0,
258 creationOptions = None, srcWin = None, projWin = None, projWinSRS = None, strict = False,
259 unscale = False, scaleParams = None, exponents = None,
260 outputBounds = None, metadataOptions = None,
261 outputSRS = None, GCPs = None,
262 noData = None, rgbExpand = None,
263 stats = False, rat = True, resampleAlg = None,
264 callback = None, callback_data = None):
265 """ Create a TranslateOptions() object that can be passed to gdal.Translate()
266 Keyword arguments are :
267 options --- can be be an array of strings, a string or let empty and filled from other keywords.
268 format --- output format ("GTiff", etc...)
269 outputType --- output type (gdal.GDT_Byte, etc...)
270 bandList --- array of band numbers (index start at 1)
271 maskBand --- mask band to generate or not ("none", "auto", "mask", 1, ...)
272 width --- width of the output raster in pixel
273 height --- height of the output raster in pixel
274 widthPct --- width of the output raster in percentage (100 = original width)
275 heightPct --- height of the output raster in percentage (100 = original height)
276 xRes --- output horizontal resolution
277 yRes --- output vertical resolution
278 creationOptions --- list of creation options
279 srcWin --- subwindow in pixels to extract: [left_x, top_y, width, height]
280 projWin --- subwindow in projected coordinates to extract: [ulx, uly, lrx, lry]
281 projWinSRS --- SRS in which projWin is expressed
282 strict --- strict mode
283 unscale --- unscale values with scale and offset metadata
284 scaleParams --- list of scale parameters, each of the form [src_min,src_max] or [src_min,src_max,dst_min,dst_max]
285 exponents --- list of exponentiation parameters
286 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry]
287 metadataOptions --- list of metadata options
288 outputSRS --- assigned output SRS
289 GCPs --- list of GCPs
290 noData --- nodata value (or "none" to unset it)
291 rgbExpand --- Color palette expansion mode: "gray", "rgb", "rgba"
292 stats --- whether to calculate statistics
293 rat --- whether to write source RAT
294 resampleAlg --- resampling mode
295 callback --- callback method
296 callback_data --- user data for callback
297 """
298 import copy
299
300 if _is_str_or_unicode(options):
301 new_options = ParseCommandLine(options)
302 else:
303 new_options = copy.copy(options)
304 if format is not None:
305 new_options += ['-of', format]
306 if outputType != GDT_Unknown:
307 new_options += ['-ot', GetDataTypeName(outputType) ]
308 if maskBand != None:
309 new_options += ['-mask', str(maskBand) ]
310 if bandList != None:
311 for b in bandList:
312 new_options += ['-b', str(b) ]
313 if width != 0 or height != 0:
314 new_options += ['-outsize', str(width), str(height)]
315 elif widthPct != 0 and heightPct != 0:
316 new_options += ['-outsize', str(widthPct) + '%%', str(heightPct) + '%%']
317 if creationOptions is not None:
318 for opt in creationOptions:
319 new_options += ['-co', opt ]
320 if srcWin is not None:
321 new_options += ['-srcwin', _strHighPrec(srcWin[0]), _strHighPrec(srcWin[1]), _strHighPrec(srcWin[2]), _strHighPrec(srcWin[3])]
322 if strict:
323 new_options += ['-strict']
324 if unscale:
325 new_options += ['-unscale']
326 if scaleParams:
327 for scaleParam in scaleParams:
328 new_options += ['-scale']
329 for v in scaleParam:
330 new_options += [ str(v) ]
331 if exponents:
332 for exponent in exponents:
333 new_options += ['-exponent', _strHighPrec(exponent)]
334 if outputBounds is not None:
335 new_options += ['-a_ullr', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
336 if metadataOptions is not None:
337 for opt in metadataOptions:
338 new_options += ['-mo', opt ]
339 if outputSRS is not None:
340 new_options += ['-a_srs', str(outputSRS) ]
341 if GCPs is not None:
342 for gcp in GCPs:
343 new_options += ['-gcp', _strHighPrec(gcp.GCPPixel), _strHighPrec(gcp.GCPLine), _strHighPrec(gcp.GCPX), str(gcp.GCPY), _strHighPrec(gcp.GCPZ) ]
344 if projWin is not None:
345 new_options += ['-projwin', _strHighPrec(projWin[0]), _strHighPrec(projWin[1]), _strHighPrec(projWin[2]), _strHighPrec(projWin[3])]
346 if projWinSRS is not None:
347 new_options += ['-projwin_srs', str(projWinSRS) ]
348 if noData is not None:
349 new_options += ['-a_nodata', _strHighPrec(noData) ]
350 if rgbExpand is not None:
351 new_options += ['-expand', str(rgbExpand) ]
352 if stats:
353 new_options += ['-stats']
354 if not rat:
355 new_options += ['-norat']
356 if resampleAlg is not None:
357 if resampleAlg == GRA_NearestNeighbour:
358 new_options += ['-r', 'near']
359 elif resampleAlg == GRA_Bilinear:
360 new_options += ['-r', 'bilinear']
361 elif resampleAlg == GRA_Cubic:
362 new_options += ['-r', 'cubic']
363 elif resampleAlg == GRA_CubicSpline:
364 new_options += ['-r', 'cubicspline']
365 elif resampleAlg == GRA_Lanczos:
366 new_options += ['-r', 'lanczos']
367 elif resampleAlg == GRA_Average:
368 new_options += ['-r', 'average']
369 elif resampleAlg == GRA_Mode:
370 new_options += ['-r', 'mode']
371 else:
372 new_options += ['-r', str(resampleAlg) ]
373 if xRes != 0 and yRes != 0:
374 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes) ]
375
376 return (GDALTranslateOptions(new_options), callback, callback_data)
377
379 """ Convert a dataset.
380 Arguments are :
381 destName --- Output dataset name
382 srcDS --- a Dataset object or a filename
383 Keyword arguments are :
384 options --- return of gdal.TranslateOptions(), string or array of strings
385 other keywords arguments of gdal.TranslateOptions()
386 If options is provided as a gdal.TranslateOptions() object, other keywords are ignored. """
387
388 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
389 (opts, callback, callback_data) = TranslateOptions(**kwargs)
390 else:
391 (opts, callback, callback_data) = kwargs['options']
392 if _is_str_or_unicode(srcDS):
393 srcDS = Open(srcDS)
394
395 return TranslateInternal(destName, srcDS, opts, callback, callback_data)
396
397 -def WarpOptions(options = [], format = None,
398 outputBounds = None,
399 outputBoundsSRS = None,
400 xRes = None, yRes = None, targetAlignedPixels = False,
401 width = 0, height = 0,
402 srcSRS = None, dstSRS = None,
403 srcAlpha = False, dstAlpha = False,
404 warpOptions = None, errorThreshold = None,
405 warpMemoryLimit = None, creationOptions = None, outputType = GDT_Unknown,
406 workingType = GDT_Unknown, resampleAlg = None,
407 srcNodata = None, dstNodata = None, multithread = False,
408 tps = False, rpc = False, geoloc = False, polynomialOrder = None,
409 transformerOptions = None, cutlineDSName = None,
410 cutlineLayer = None, cutlineWhere = None, cutlineSQL = None, cutlineBlend = None, cropToCutline = False,
411 copyMetadata = True, metadataConflictValue = None,
412 setColorInterpretation = False,
413 callback = None, callback_data = None):
414 """ Create a WarpOptions() object that can be passed to gdal.Warp()
415 Keyword arguments are :
416 options --- can be be an array of strings, a string or let empty and filled from other keywords.
417 format --- output format ("GTiff", etc...)
418 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS
419 outputBoundsSRS --- SRS in which output bounds are expressed, in the case they are not expressed in dstSRS
420 xRes, yRes --- output resolution in target SRS
421 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution
422 width --- width of the output raster in pixel
423 height --- height of the output raster in pixel
424 srcSRS --- source SRS
425 dstSRS --- output SRS
426 srcAlpha --- whether to force the last band of the input dataset to be considered as an alpha band
427 dstAlpha --- whether to force the creation of an output alpha band
428 outputType --- output type (gdal.GDT_Byte, etc...)
429 workingType --- working type (gdal.GDT_Byte, etc...)
430 warpOptions --- list of warping options
431 errorThreshold --- error threshold for approximation transformer (in pixels)
432 warpMemoryLimit --- size of working buffer in bytes
433 resampleAlg --- resampling mode
434 creationOptions --- list of creation options
435 srcNodata --- source nodata value(s)
436 dstNodata --- output nodata value(s)
437 multithread --- whether to multithread computation and I/O operations
438 tps --- whether to use Thin Plate Spline GCP transformer
439 rpc --- whether to use RPC transformer
440 geoloc --- whether to use GeoLocation array transformer
441 polynomialOrder --- order of polynomial GCP interpolation
442 transformerOptions --- list of transformer options
443 cutlineDSName --- cutline dataset name
444 cutlineLayer --- cutline layer name
445 cutlineWhere --- cutline WHERE clause
446 cutlineSQL --- cutline SQL statement
447 cutlineBlend --- cutline blend distance in pixels
448 cropToCutline --- whether to use cutline extent for output bounds
449 copyMetadata --- whether to copy source metadata
450 metadataConflictValue --- metadata data conflict value
451 setColorInterpretation --- whether to force color interpretation of input bands to output bands
452 callback --- callback method
453 callback_data --- user data for callback
454 """
455 import copy
456
457 if _is_str_or_unicode(options):
458 new_options = ParseCommandLine(options)
459 else:
460 new_options = copy.copy(options)
461 if format is not None:
462 new_options += ['-of', format]
463 if outputType != GDT_Unknown:
464 new_options += ['-ot', GetDataTypeName(outputType) ]
465 if workingType != GDT_Unknown:
466 new_options += ['-wt', GetDataTypeName(workingType) ]
467 if outputBounds is not None:
468 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3]) ]
469 if outputBoundsSRS is not None:
470 new_options += ['-te_srs', str(outputBoundsSRS) ]
471 if xRes is not None and yRes is not None:
472 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes) ]
473 if width != 0 or height != 0:
474 new_options += ['-ts', str(width), str(height)]
475 if srcSRS is not None:
476 new_options += ['-s_srs', str(srcSRS) ]
477 if dstSRS is not None:
478 new_options += ['-t_srs', str(dstSRS) ]
479 if targetAlignedPixels:
480 new_options += ['-tap']
481 if srcAlpha:
482 new_options += ['-srcalpha']
483 if dstAlpha:
484 new_options += ['-dstalpha']
485 if warpOptions is not None:
486 for opt in warpOptions:
487 new_options += ['-wo', str(opt)]
488 if errorThreshold is not None:
489 new_options += ['-et', _strHighPrec(errorThreshold)]
490 if resampleAlg is not None:
491 if resampleAlg == GRIORA_NearestNeighbour:
492 new_options += ['-r', 'near']
493 elif resampleAlg == GRIORA_Bilinear:
494 new_options += ['-rb']
495 elif resampleAlg == GRIORA_Cubic:
496 new_options += ['-rc']
497 elif resampleAlg == GRIORA_CubicSpline:
498 new_options += ['-rcs']
499 elif resampleAlg == GRIORA_Lanczos:
500 new_options += ['-r', 'lanczos']
501 elif resampleAlg == GRIORA_Average:
502 new_options += ['-r', 'average']
503 elif resampleAlg == GRIORA_Mode:
504 new_options += ['-r', 'mode']
505 elif resampleAlg == GRIORA_Gauss:
506 new_options += ['-r', 'gauss']
507 else:
508 new_options += ['-r', str(resampleAlg) ]
509 if warpMemoryLimit is not None:
510 new_options += ['-wm', str(warpMemoryLimit) ]
511 if creationOptions is not None:
512 for opt in creationOptions:
513 new_options += ['-co', opt ]
514 if srcNodata is not None:
515 new_options += ['-srcnodata', str(srcNodata) ]
516 if dstNodata is not None:
517 new_options += ['-dstnodata', str(dstNodata) ]
518 if multithread:
519 new_options += ['-multi']
520 if tps:
521 new_options += ['-tps']
522 if rpc:
523 new_options += ['-rpc']
524 if geoloc:
525 new_options += ['-geoloc']
526 if polynomialOrder is not None:
527 new_options += ['-order', str(polynomialOrder)]
528 if transformerOptions is not None:
529 for opt in transformerOptions:
530 new_options += ['-to', opt ]
531 if cutlineDSName is not None:
532 new_options += ['-cutline', str(cutlineDSName) ]
533 if cutlineLayer is not None:
534 new_options += ['-cl', str(cutlineLayer) ]
535 if cutlineWhere is not None:
536 new_options += ['-cwhere', str(cutlineWhere) ]
537 if cutlineSQL is not None:
538 new_options += ['-csql', str(cutlineSQL) ]
539 if cutlineBlend is not None:
540 new_options += ['-cblend', str(cutlineBlend) ]
541 if cropToCutline:
542 new_options += ['-crop_to_cutline']
543 if not copyMetadata:
544 new_options += ['-nomd']
545 if metadataConflictValue:
546 new_options += ['-cvmd', str(metadataConflictValue) ]
547 if setColorInterpretation:
548 new_options += ['-setci']
549
550 return (GDALWarpAppOptions(new_options), callback, callback_data)
551
552 -def Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs):
553 """ Warp one or several datasets.
554 Arguments are :
555 destNameOrDestDS --- Output dataset name or object
556 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename
557 Keyword arguments are :
558 options --- return of gdal.WarpOptions(), string or array of strings
559 other keywords arguments of gdal.WarpOptions()
560 If options is provided as a gdal.WarpOptions() object, other keywords are ignored. """
561
562 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
563 (opts, callback, callback_data) = WarpOptions(**kwargs)
564 else:
565 (opts, callback, callback_data) = kwargs['options']
566 if _is_str_or_unicode(srcDSOrSrcDSTab):
567 srcDSTab = [Open(srcDSOrSrcDSTab)]
568 elif type(srcDSOrSrcDSTab) == type([]):
569 srcDSTab = []
570 for elt in srcDSOrSrcDSTab:
571 if _is_str_or_unicode(elt):
572 srcDSTab.append(Open(elt))
573 else:
574 srcDSTab.append(elt)
575 else:
576 srcDSTab = [ srcDSOrSrcDSTab ]
577
578 if _is_str_or_unicode(destNameOrDestDS):
579 return wrapper_GDALWarpDestName(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
580 else:
581 return wrapper_GDALWarpDestDS(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
582
583
584 -def VectorTranslateOptions(options = [], format = None,
585 accessMode = None,
586 srcSRS = None, dstSRS = None, reproject = True,
587 SQLStatement = None, SQLDialect = None, where = None, selectFields = None,
588 addFields = False,
589 forceNullable = False,
590 spatFilter = None, spatSRS = None,
591 datasetCreationOptions = None,
592 layerCreationOptions = None,
593 layers = None,
594 layerName = None,
595 geometryType = None,
596 dim = None,
597 segmentizeMaxDist= None,
598 zField = None,
599 skipFailures = False,
600 limit = None,
601 callback = None, callback_data = None):
602 """ Create a VectorTranslateOptions() object that can be passed to gdal.VectorTranslate()
603 Keyword arguments are :
604 options --- can be be an array of strings, a string or let empty and filled from other keywords.
605 format --- output format ("ESRI Shapefile", etc...)
606 accessMode --- None for creation, 'update', 'append', 'overwrite'
607 srcSRS --- source SRS
608 dstSRS --- output SRS (with reprojection if reproject = True)
609 reproject --- whether to do reprojection
610 SQLStatement --- SQL statement to apply to the source dataset
611 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...)
612 where --- WHERE clause to apply to source layer(s)
613 selectFields --- list of fields to select
614 addFields --- whether to add new fields found in source layers (to be used with accessMode == 'append')
615 forceNullable --- whether to drop NOT NULL constraints on newly created fields
616 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box
617 spatSRS --- SRS in which the spatFilter is expressed. If not specified, it is assumed to be the one of the layer(s)
618 datasetCreationOptions --- list of dataset creation options
619 layerCreationOptions --- list of layer creation options
620 layers --- list of layers to convert
621 layerName --- output layer name
622 geometryType --- output layer geometry type ('POINT', ....)
623 dim --- output dimension ('XY', 'XYZ', 'XYM', 'XYZM', 'layer_dim')
624 segmentizeMaxDist --- maximum distance between consecutive nodes of a line geometry
625 zField --- name of field to use to set the Z component of geometries
626 skipFailures --- whether to skip failures
627 limit -- maximum number of features to read per layer
628 callback --- callback method
629 callback_data --- user data for callback
630 """
631 import copy
632
633 if _is_str_or_unicode(options):
634 new_options = ParseCommandLine(options)
635 else:
636 new_options = copy.copy(options)
637 if format is not None:
638 new_options += ['-f', format]
639 if srcSRS is not None:
640 new_options += ['-s_srs', str(srcSRS) ]
641 if dstSRS is not None:
642 if reproject:
643 new_options += ['-t_srs', str(dstSRS) ]
644 else:
645 new_options += ['-a_srs', str(dstSRS) ]
646 if SQLStatement is not None:
647 new_options += ['-sql', str(SQLStatement) ]
648 if SQLDialect is not None:
649 new_options += ['-dialect', str(SQLDialect) ]
650 if where is not None:
651 new_options += ['-where', str(where) ]
652 if accessMode is not None:
653 if accessMode == 'update':
654 new_options += ['-update']
655 elif accessMode == 'append':
656 new_options += ['-append']
657 elif accessMode == 'overwrite':
658 new_options += ['-overwrite']
659 else:
660 raise Exception('unhandled accessMode')
661 if addFields:
662 new_options += ['-addfields']
663 if forceNullable:
664 new_options += ['-forceNullable']
665 if selectFields is not None:
666 val = ''
667 for item in selectFields:
668 if len(val)>0:
669 val += ','
670 val += item
671 new_options += ['-select', val]
672 if datasetCreationOptions is not None:
673 for opt in datasetCreationOptions:
674 new_options += ['-dsco', opt ]
675 if layerCreationOptions is not None:
676 for opt in layerCreationOptions:
677 new_options += ['-lco', opt ]
678 if layers is not None:
679 if _is_str_or_unicode(layers):
680 new_options += [ layers ]
681 else:
682 for lyr in layers:
683 new_options += [ lyr ]
684 if segmentizeMaxDist is not None:
685 new_options += ['-segmentize', str(segmentizeMaxDist) ]
686 if spatFilter is not None:
687 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3]) ]
688 if spatSRS is not None:
689 new_options += ['-spat_srs', str(spatSRS) ]
690 if layerName is not None:
691 new_options += ['-nln', layerName]
692 if geometryType is not None:
693 new_options += ['-nlt', geometryType]
694 if dim is not None:
695 new_options += ['-dim', dim]
696 if zField is not None:
697 new_options += ['-zfield', zField]
698 if skipFailures:
699 new_options += ['-skip']
700 if limit is not None:
701 new_options += ['-limit', str(limit)]
702 if callback is not None:
703 new_options += [ '-progress' ]
704
705 return (GDALVectorTranslateOptions(new_options), callback, callback_data)
706
708 """ Convert one vector dataset
709 Arguments are :
710 destNameOrDestDS --- Output dataset name or object
711 srcDS --- a Dataset object or a filename
712 Keyword arguments are :
713 options --- return of gdal.VectorTranslateOptions(), string or array of strings
714 other keywords arguments of gdal.VectorTranslateOptions()
715 If options is provided as a gdal.VectorTranslateOptions() object, other keywords are ignored. """
716
717 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
718 (opts, callback, callback_data) = VectorTranslateOptions(**kwargs)
719 else:
720 (opts, callback, callback_data) = kwargs['options']
721 if _is_str_or_unicode(srcDS):
722 srcDS = OpenEx(srcDS, OF_VECTOR)
723
724 if _is_str_or_unicode(destNameOrDestDS):
725 return wrapper_GDALVectorTranslateDestName(destNameOrDestDS, srcDS, opts, callback, callback_data)
726 else:
727 return wrapper_GDALVectorTranslateDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
728
729 -def DEMProcessingOptions(options = [], colorFilename = None, format = None,
730 creationOptions = None, computeEdges = False, alg = 'Horn', band = 1,
731 zFactor = None, scale = None, azimuth = None, altitude = None,
732 combined = False, multiDirectional = False,
733 slopeFormat = None, trigonometric = False, zeroForFlat = False,
734 addAlpha = None,
735 callback = None, callback_data = None):
736 """ Create a DEMProcessingOptions() object that can be passed to gdal.DEMProcessing()
737 Keyword arguments are :
738 options --- can be be an array of strings, a string or let empty and filled from other keywords.
739 colorFilename --- (mandatory for "color-relief") name of file that contains palette definition for the "color-relief" processing.
740 format --- output format ("GTiff", etc...)
741 creationOptions --- list of creation options
742 computeEdges --- whether to compute values at raster edges.
743 alg --- 'ZevenbergenThorne' or 'Horn'
744 band --- source band number to use
745 zFactor --- (hillshade only) vertical exaggeration used to pre-multiply the elevations.
746 scale --- ratio of vertical units to horizontal.
747 azimuth --- (hillshade only) azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps.
748 altitude ---(hillshade only) altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.
749 combined --- (hillshade only) whether to compute combined shading, a combination of slope and oblique shading.
750 multiDirectional --- (hillshade only) whether to compute multi-directional shading
751 slopeformat --- (slope only) "degree" or "percent".
752 trigonometric --- (aspect only) whether to return trigonometric angle instead of azimuth. Thus 0deg means East, 90deg North, 180deg West, 270deg South.
753 zeroForFlat --- (aspect only) whether to return 0 for flat areas with slope=0, instead of -9999.
754 addAlpha --- adds an alpha band to the output file (only for processing = 'color-relief')
755 callback --- callback method
756 callback_data --- user data for callback
757 """
758 import copy
759
760 if _is_str_or_unicode(options):
761 new_options = ParseCommandLine(options)
762 else:
763 new_options = copy.copy(options)
764 if format is not None:
765 new_options += ['-of', format]
766 if creationOptions is not None:
767 for opt in creationOptions:
768 new_options += ['-co', opt ]
769 if computeEdges:
770 new_options += ['-compute_edges' ]
771 if alg == 'ZevenbergenThorne':
772 new_options += ['-alg', 'ZevenbergenThorne']
773 new_options += ['-b', str(band) ]
774 if zFactor is not None:
775 new_options += ['-z', str(zFactor) ]
776 if scale is not None:
777 new_options += ['-s', str(scale) ]
778 if azimuth is not None:
779 new_options += ['-az', str(azimuth) ]
780 if altitude is not None:
781 new_options += ['-alt', str(altitude) ]
782 if combined:
783 new_options += ['-combined' ]
784 if multiDirectional:
785 new_options += ['-multidirectional' ]
786 if slopeFormat == 'percent':
787 new_options += ['-p' ]
788 if trigonometric:
789 new_options += ['-trigonometric' ]
790 if zeroForFlat:
791 new_options += ['-zero_for_flat' ]
792 if addAlpha:
793 new_options += [ '-alpha' ]
794
795 return (GDALDEMProcessingOptions(new_options), colorFilename, callback, callback_data)
796
798 """ Apply a DEM processing.
799 Arguments are :
800 destName --- Output dataset name
801 srcDS --- a Dataset object or a filename
802 processing --- one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness"
803 Keyword arguments are :
804 options --- return of gdal.DEMProcessingOptions(), string or array of strings
805 other keywords arguments of gdal.DEMProcessingOptions()
806 If options is provided as a gdal.DEMProcessingOptions() object, other keywords are ignored. """
807
808 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
809 (opts, colorFilename, callback, callback_data) = DEMProcessingOptions(**kwargs)
810 else:
811 (opts, colorFilename, callback, callback_data) = kwargs['options']
812 if _is_str_or_unicode(srcDS):
813 srcDS = Open(srcDS)
814
815 return DEMProcessingInternal(destName, srcDS, processing, colorFilename, opts, callback, callback_data)
816
817
818 -def NearblackOptions(options = [], format = None,
819 creationOptions = None, white = False, colors = None,
820 maxNonBlack = None, nearDist = None, setAlpha = False, setMask = False,
821 callback = None, callback_data = None):
822 """ Create a NearblackOptions() object that can be passed to gdal.Nearblack()
823 Keyword arguments are :
824 options --- can be be an array of strings, a string or let empty and filled from other keywords.
825 format --- output format ("GTiff", etc...)
826 creationOptions --- list of creation options
827 white --- whether to search for nearly white (255) pixels instead of nearly black pixels.
828 colors --- list of colors to search for, e.g. ((0,0,0),(255,255,255)). The pixels that are considered as the collar are set to 0
829 maxNonBlack --- number of non-black (or other searched colors specified with white / colors) pixels that can be encountered before the giving up search inwards. Defaults to 2.
830 nearDist --- select how far from black, white or custom colors the pixel values can be and still considered near black, white or custom color. Defaults to 15.
831 setAlpha --- adds an alpha band to the output file.
832 setMask --- adds a mask band to the output file.
833 callback --- callback method
834 callback_data --- user data for callback
835 """
836 import copy
837
838 if _is_str_or_unicode(options):
839 new_options = ParseCommandLine(options)
840 else:
841 new_options = copy.copy(options)
842 if format is not None:
843 new_options += ['-of', format]
844 if creationOptions is not None:
845 for opt in creationOptions:
846 new_options += ['-co', opt ]
847 if white:
848 new_options += ['-white']
849 if colors is not None:
850 for color in colors:
851 color_str = ''
852 for cpt in color:
853 if color_str != '':
854 color_str += ','
855 color_str += str(cpt)
856 new_options += ['-color',color_str]
857 if maxNonBlack is not None:
858 new_options += ['-nb', str(maxNonBlack) ]
859 if nearDist is not None:
860 new_options += ['-near', str(nearDist) ]
861 if setAlpha:
862 new_options += ['-setalpha']
863 if setMask:
864 new_options += ['-setmask']
865
866 return (GDALNearblackOptions(new_options), callback, callback_data)
867
868 -def Nearblack(destNameOrDestDS, srcDS, **kwargs):
869 """ Convert nearly black/white borders to exact value.
870 Arguments are :
871 destNameOrDestDS --- Output dataset name or object
872 srcDS --- a Dataset object or a filename
873 Keyword arguments are :
874 options --- return of gdal.NearblackOptions(), string or array of strings
875 other keywords arguments of gdal.NearblackOptions()
876 If options is provided as a gdal.NearblackOptions() object, other keywords are ignored. """
877
878 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
879 (opts, callback, callback_data) = NearblackOptions(**kwargs)
880 else:
881 (opts, callback, callback_data) = kwargs['options']
882 if _is_str_or_unicode(srcDS):
883 srcDS = OpenEx(srcDS)
884
885 if _is_str_or_unicode(destNameOrDestDS):
886 return wrapper_GDALNearblackDestName(destNameOrDestDS, srcDS, opts, callback, callback_data)
887 else:
888 return wrapper_GDALNearblackDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
889
890
891 -def GridOptions(options = [], format = None,
892 outputType = GDT_Unknown,
893 width = 0, height = 0,
894 creationOptions = None,
895 outputBounds = None,
896 outputSRS = None,
897 noData = None,
898 algorithm = None,
899 layers = None,
900 SQLStatement = None,
901 where = None,
902 spatFilter = None,
903 zfield = None,
904 z_increase = None,
905 z_multiply = None,
906 callback = None, callback_data = None):
907 """ Create a GridOptions() object that can be passed to gdal.Grid()
908 Keyword arguments are :
909 options --- can be be an array of strings, a string or let empty and filled from other keywords.
910 format --- output format ("GTiff", etc...)
911 outputType --- output type (gdal.GDT_Byte, etc...)
912 width --- width of the output raster in pixel
913 height --- height of the output raster in pixel
914 creationOptions --- list of creation options
915 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry]
916 outputSRS --- assigned output SRS
917 noData --- nodata value
918 algorithm --- e.g "invdist:power=2.0:smoothing=0.0:radius1=0.0:radius2=0.0:angle=0.0:max_points=0:min_points=0:nodata=0.0"
919 layers --- list of layers to convert
920 SQLStatement --- SQL statement to apply to the source dataset
921 where --- WHERE clause to apply to source layer(s)
922 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box
923 zfield --- Identifies an attribute field on the features to be used to get a Z value from. This value overrides Z value read from feature geometry record.
924 z_increase --- Addition to the attribute field on the features to be used to get a Z value from. The addition should be the same unit as Z value. The result value will be Z value + Z increase value. The default value is 0.
925 z_multiply - Multiplication ratio for Z field. This can be used for shift from e.g. foot to meters or from elevation to deep. The result value will be (Z value + Z increase value) * Z multiply value. The default value is 1.
926 callback --- callback method
927 callback_data --- user data for callback
928 """
929 import copy
930
931 if _is_str_or_unicode(options):
932 new_options = ParseCommandLine(options)
933 else:
934 new_options = copy.copy(options)
935 if format is not None:
936 new_options += ['-of', format]
937 if outputType != GDT_Unknown:
938 new_options += ['-ot', GetDataTypeName(outputType) ]
939 if width != 0 or height != 0:
940 new_options += ['-outsize', str(width), str(height)]
941 if creationOptions is not None:
942 for opt in creationOptions:
943 new_options += ['-co', opt ]
944 if outputBounds is not None:
945 new_options += ['-txe', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[2]), '-tye', _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[3])]
946 if outputSRS is not None:
947 new_options += ['-a_srs', str(outputSRS) ]
948 if algorithm is not None:
949 new_options += ['-a', algorithm ]
950 if layers is not None:
951 if type(layers) == type(()) or type(layers) == type([]):
952 for layer in layers:
953 new_options += ['-l', layer]
954 else:
955 new_options += ['-l', layers]
956 if SQLStatement is not None:
957 new_options += ['-sql', str(SQLStatement) ]
958 if where is not None:
959 new_options += ['-where', str(where) ]
960 if zfield is not None:
961 new_options += ['-zfield', zfield ]
962 if z_increase is not None:
963 new_options += ['-z_increase', str(z_increase) ]
964 if z_multiply is not None:
965 new_options += ['-z_multiply', str(z_multiply) ]
966 if spatFilter is not None:
967 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3]) ]
968
969 return (GDALGridOptions(new_options), callback, callback_data)
970
971 -def Grid(destName, srcDS, **kwargs):
972 """ Create raster from the scattered data.
973 Arguments are :
974 destName --- Output dataset name
975 srcDS --- a Dataset object or a filename
976 Keyword arguments are :
977 options --- return of gdal.GridOptions(), string or array of strings
978 other keywords arguments of gdal.GridOptions()
979 If options is provided as a gdal.GridOptions() object, other keywords are ignored. """
980
981 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
982 (opts, callback, callback_data) = GridOptions(**kwargs)
983 else:
984 (opts, callback, callback_data) = kwargs['options']
985 if _is_str_or_unicode(srcDS):
986 srcDS = OpenEx(srcDS, OF_VECTOR)
987
988 return GridInternal(destName, srcDS, opts, callback, callback_data)
989
990 -def RasterizeOptions(options = [], format = None,
991 outputType = GDT_Unknown,
992 creationOptions = None, noData = None, initValues = None,
993 outputBounds = None, outputSRS = None,
994 transformerOptions = None,
995 width = None, height = None,
996 xRes = None, yRes = None, targetAlignedPixels = False,
997 bands = None, inverse = False, allTouched = False,
998 burnValues = None, attribute = None, useZ = False, layers = None,
999 SQLStatement = None, SQLDialect = None, where = None, optim = None,
1000 callback = None, callback_data = None):
1001 """ Create a RasterizeOptions() object that can be passed to gdal.Rasterize()
1002 Keyword arguments are :
1003 options --- can be be an array of strings, a string or let empty and filled from other keywords.
1004 format --- output format ("GTiff", etc...)
1005 outputType --- output type (gdal.GDT_Byte, etc...)
1006 creationOptions --- list of creation options
1007 outputBounds --- assigned output bounds: [minx, miny, maxx, maxy]
1008 outputSRS --- assigned output SRS
1009 transformerOptions --- list of transformer options
1010 width --- width of the output raster in pixel
1011 height --- height of the output raster in pixel
1012 xRes, yRes --- output resolution in target SRS
1013 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution
1014 noData --- nodata value
1015 initValues --- Value or list of values to pre-initialize the output image bands with. However, it is not marked as the nodata value in the output file. If only one value is given, the same value is used in all the bands.
1016 bands --- list of output bands to burn values into
1017 inverse --- whether to invert rasterization, i.e. burn the fixed burn value, or the burn value associated with the first feature into all parts of the image not inside the provided a polygon.
1018 allTouched -- whether to enable the ALL_TOUCHED rasterization option so that all pixels touched by lines or polygons will be updated, not just those on the line render path, or whose center point is within the polygon.
1019 burnValues -- list of fixed values to burn into each band for all objects. Excusive with attribute.
1020 attribute --- identifies an attribute field on the features to be used for a burn-in value. The value will be burned into all output bands. Excusive with burnValues.
1021 useZ --- whether to indicate that a burn value should be extracted from the "Z" values of the feature. These values are added to the burn value given by burnValues or attribute if provided. As of now, only points and lines are drawn in 3D.
1022 layers --- list of layers from the datasource that will be used for input features.
1023 SQLStatement --- SQL statement to apply to the source dataset
1024 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...)
1025 where --- WHERE clause to apply to source layer(s)
1026 callback --- callback method
1027 callback_data --- user data for callback
1028 """
1029 import copy
1030
1031 if _is_str_or_unicode(options):
1032 new_options = ParseCommandLine(options)
1033 else:
1034 new_options = copy.copy(options)
1035 if format is not None:
1036 new_options += ['-of', format]
1037 if outputType != GDT_Unknown:
1038 new_options += ['-ot', GetDataTypeName(outputType) ]
1039 if creationOptions is not None:
1040 for opt in creationOptions:
1041 new_options += ['-co', opt ]
1042 if bands is not None:
1043 for b in bands:
1044 new_options += ['-b', str(b) ]
1045 if noData is not None:
1046 new_options += ['-a_nodata', str(noData) ]
1047 if initValues is not None:
1048 if type(initValues) == type(()) or type(initValues) == type([]):
1049 for val in initValues:
1050 new_options += ['-init', str(val) ]
1051 else:
1052 new_options += ['-init', str(initValues) ]
1053 if outputBounds is not None:
1054 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
1055 if outputSRS is not None:
1056 new_options += ['-a_srs', str(outputSRS) ]
1057 if transformerOptions is not None:
1058 for opt in transformerOptions:
1059 new_options += ['-to', opt ]
1060 if width is not None and height is not None:
1061 new_options += ['-ts', str(width), str(height)]
1062 if xRes is not None and yRes is not None:
1063 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)]
1064 if targetAlignedPixels:
1065 new_options += ['-tap']
1066 if inverse:
1067 new_options += ['-i']
1068 if allTouched:
1069 new_options += ['-at']
1070 if burnValues is not None:
1071 if attribute is not None:
1072 raise Exception('burnValues and attribute option are exclusive.')
1073 if type(burnValues) == type(()) or type(burnValues) == type([]):
1074 for val in burnValues:
1075 new_options += ['-burn', str(val) ]
1076 else:
1077 new_options += ['-burn', str(burnValues) ]
1078 if attribute is not None:
1079 new_options += ['-a', attribute]
1080 if useZ:
1081 new_options += ['-3d']
1082 if layers is not None:
1083 if type(layers) == type(()) or type(layers) == type([]):
1084 for layer in layers:
1085 new_options += ['-l', layer]
1086 else:
1087 new_options += ['-l', layers]
1088 if SQLStatement is not None:
1089 new_options += ['-sql', str(SQLStatement) ]
1090 if SQLDialect is not None:
1091 new_options += ['-dialect', str(SQLDialect) ]
1092 if where is not None:
1093 new_options += ['-where', str(where) ]
1094 if optim is not None:
1095 new_options += ['-optim', str(optim) ]
1096
1097 return (GDALRasterizeOptions(new_options), callback, callback_data)
1098
1099 -def Rasterize(destNameOrDestDS, srcDS, **kwargs):
1100 """ Burns vector geometries into a raster
1101 Arguments are :
1102 destNameOrDestDS --- Output dataset name or object
1103 srcDS --- a Dataset object or a filename
1104 Keyword arguments are :
1105 options --- return of gdal.RasterizeOptions(), string or array of strings
1106 other keywords arguments of gdal.RasterizeOptions()
1107 If options is provided as a gdal.RasterizeOptions() object, other keywords are ignored. """
1108
1109 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
1110 (opts, callback, callback_data) = RasterizeOptions(**kwargs)
1111 else:
1112 (opts, callback, callback_data) = kwargs['options']
1113 if _is_str_or_unicode(srcDS):
1114 srcDS = OpenEx(srcDS, OF_VECTOR)
1115
1116 if _is_str_or_unicode(destNameOrDestDS):
1117 return wrapper_GDALRasterizeDestName(destNameOrDestDS, srcDS, opts, callback, callback_data)
1118 else:
1119 return wrapper_GDALRasterizeDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1120
1121
1122 -def BuildVRTOptions(options = [],
1123 resolution = None,
1124 outputBounds = None,
1125 xRes = None, yRes = None,
1126 targetAlignedPixels = None,
1127 separate = None,
1128 bandList = None,
1129 addAlpha = None,
1130 resampleAlg = None,
1131 outputSRS = None,
1132 allowProjectionDifference = None,
1133 srcNodata = None,
1134 VRTNodata = None,
1135 hideNodata = None,
1136 callback = None, callback_data = None):
1137 """ Create a BuildVRTOptions() object that can be passed to gdal.BuildVRT()
1138 Keyword arguments are :
1139 options --- can be be an array of strings, a string or let empty and filled from other keywords..
1140 resolution --- 'highest', 'lowest', 'average', 'user'.
1141 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS.
1142 xRes, yRes --- output resolution in target SRS.
1143 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution.
1144 separate --- whether each source file goes into a separate stacked band in the VRT band.
1145 bandList --- array of band numbers (index start at 1).
1146 addAlpha --- whether to add an alpha mask band to the VRT when the source raster have none.
1147 resampleAlg --- resampling mode.
1148 outputSRS --- assigned output SRS.
1149 allowProjectionDifference --- whether to accept input datasets have not the same projection. Note: they will *not* be reprojected.
1150 srcNodata --- source nodata value(s).
1151 VRTNodata --- nodata values at the VRT band level.
1152 hideNodata --- whether to make the VRT band not report the NoData value.
1153 callback --- callback method.
1154 callback_data --- user data for callback.
1155 """
1156 import copy
1157
1158 if _is_str_or_unicode(options):
1159 new_options = ParseCommandLine(options)
1160 else:
1161 new_options = copy.copy(options)
1162 if resolution is not None:
1163 new_options += ['-resolution', str(resolution) ]
1164 if outputBounds is not None:
1165 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
1166 if xRes is not None and yRes is not None:
1167 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)]
1168 if targetAlignedPixels:
1169 new_options += ['-tap']
1170 if separate:
1171 new_options += ['-separate']
1172 if bandList != None:
1173 for b in bandList:
1174 new_options += ['-b', str(b) ]
1175 if addAlpha:
1176 new_options += ['-addalpha']
1177 if resampleAlg is not None:
1178 if resampleAlg == GRIORA_NearestNeighbour:
1179 new_options += ['-r', 'near']
1180 elif resampleAlg == GRIORA_Bilinear:
1181 new_options += ['-rb']
1182 elif resampleAlg == GRIORA_Cubic:
1183 new_options += ['-rc']
1184 elif resampleAlg == GRIORA_CubicSpline:
1185 new_options += ['-rcs']
1186 elif resampleAlg == GRIORA_Lanczos:
1187 new_options += ['-r', 'lanczos']
1188 elif resampleAlg == GRIORA_Average:
1189 new_options += ['-r', 'average']
1190 elif resampleAlg == GRIORA_Mode:
1191 new_options += ['-r', 'mode']
1192 elif resampleAlg == GRIORA_Gauss:
1193 new_options += ['-r', 'gauss']
1194 else:
1195 new_options += ['-r', str(resampleAlg) ]
1196 if outputSRS is not None:
1197 new_options += ['-a_srs', str(outputSRS) ]
1198 if allowProjectionDifference:
1199 new_options += ['-allow_projection_difference']
1200 if srcNodata is not None:
1201 new_options += ['-srcnodata', str(srcNodata) ]
1202 if VRTNodata is not None:
1203 new_options += ['-vrtnodata', str(VRTNodata) ]
1204 if hideNodata:
1205 new_options += ['-hidenodata']
1206
1207 return (GDALBuildVRTOptions(new_options), callback, callback_data)
1208
1209 -def BuildVRT(destName, srcDSOrSrcDSTab, **kwargs):
1210 """ Build a VRT from a list of datasets.
1211 Arguments are :
1212 destName --- Output dataset name
1213 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename
1214 Keyword arguments are :
1215 options --- return of gdal.BuildVRTOptions(), string or array of strings
1216 other keywords arguments of gdal.BuildVRTOptions()
1217 If options is provided as a gdal.BuildVRTOptions() object, other keywords are ignored. """
1218
1219 if 'options' not in kwargs or type(kwargs['options']) == type([]) or _is_str_or_unicode(kwargs['options']):
1220 (opts, callback, callback_data) = BuildVRTOptions(**kwargs)
1221 else:
1222 (opts, callback, callback_data) = kwargs['options']
1223
1224 srcDSTab = []
1225 srcDSNamesTab = []
1226 if _is_str_or_unicode(srcDSOrSrcDSTab):
1227 srcDSNamesTab = [ srcDSOrSrcDSTab ]
1228 elif type(srcDSOrSrcDSTab) == type([]):
1229 for elt in srcDSOrSrcDSTab:
1230 if _is_str_or_unicode(elt):
1231 srcDSNamesTab.append(elt)
1232 else:
1233 srcDSTab.append(elt)
1234 if len(srcDSTab) != 0 and len(srcDSNamesTab) != 0:
1235 raise Exception('Mix of names and dataset objects not supported')
1236 else:
1237 srcDSTab = [ srcDSOrSrcDSTab ]
1238
1239 if len(srcDSTab) > 0:
1240 return BuildVRTInternalObjects(destName, srcDSTab, opts, callback, callback_data)
1241 else:
1242 return BuildVRTInternalNames(destName, srcDSNamesTab, opts, callback, callback_data)
1243
1244
1245
1247 """Debug(char const * msg_class, char const * message)"""
1248 return _gdal.Debug(*args)
1249
1251 """SetErrorHandler(char const * pszCallbackName=None) -> CPLErr"""
1252 return _gdal.SetErrorHandler(*args)
1253
1255 """PushErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr"""
1256 return _gdal.PushErrorHandler(*args)
1257
1261
1263 """Error(CPLErr msg_class, int err_code=0, char const * msg)"""
1264 return _gdal.Error(*args)
1265
1267 """GOA2GetAuthorizationURL(char const * pszScope) -> retStringAndCPLFree *"""
1268 return _gdal.GOA2GetAuthorizationURL(*args)
1269
1271 """GOA2GetRefreshToken(char const * pszAuthToken, char const * pszScope) -> retStringAndCPLFree *"""
1272 return _gdal.GOA2GetRefreshToken(*args)
1273
1275 """GOA2GetAccessToken(char const * pszRefreshToken, char const * pszScope) -> retStringAndCPLFree *"""
1276 return _gdal.GOA2GetAccessToken(*args)
1277
1279 """ErrorReset()"""
1280 return _gdal.ErrorReset(*args)
1281
1283 """EscapeString(int len, int scheme) -> retStringAndCPLFree *"""
1284 return _gdal.EscapeString(*args, **kwargs)
1285
1287 """GetLastErrorNo() -> int"""
1288 return _gdal.GetLastErrorNo(*args)
1289
1293
1295 """GetLastErrorMsg() -> char const *"""
1296 return _gdal.GetLastErrorMsg(*args)
1297
1299 """GetErrorCounter() -> unsigned int"""
1300 return _gdal.GetErrorCounter(*args)
1301
1305
1307 """VSIGetLastErrorMsg() -> char const *"""
1308 return _gdal.VSIGetLastErrorMsg(*args)
1309
1311 """PushFinderLocation(char const * utf8_path)"""
1312 return _gdal.PushFinderLocation(*args)
1313
1317
1319 """FinderClean()"""
1320 return _gdal.FinderClean(*args)
1321
1323 """FindFile(char const * pszClass, char const * utf8_path) -> char const *"""
1324 return _gdal.FindFile(*args)
1325
1327 """ReadDir(char const * utf8_path, int nMaxFiles=0) -> char **"""
1328 return _gdal.ReadDir(*args)
1329
1331 """ReadDirRecursive(char const * utf8_path) -> char **"""
1332 return _gdal.ReadDirRecursive(*args)
1333
1335 """SetConfigOption(char const * pszKey, char const * pszValue)"""
1336 return _gdal.SetConfigOption(*args)
1337
1339 """GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *"""
1340 return _gdal.GetConfigOption(*args)
1341
1343 """CPLBinaryToHex(int nBytes) -> retStringAndCPLFree *"""
1344 return _gdal.CPLBinaryToHex(*args)
1345
1347 """CPLHexToBinary(char const * pszHex, int * pnBytes) -> GByte *"""
1348 return _gdal.CPLHexToBinary(*args)
1349
1351 """FileFromMemBuffer(char const * utf8_path, GIntBig nBytes)"""
1352 return _gdal.FileFromMemBuffer(*args)
1353
1355 """Unlink(char const * utf8_path) -> VSI_RETVAL"""
1356 return _gdal.Unlink(*args)
1357
1361
1363 """Mkdir(char const * utf8_path, int mode) -> VSI_RETVAL"""
1364 return _gdal.Mkdir(*args)
1365
1367 """Rmdir(char const * utf8_path) -> VSI_RETVAL"""
1368 return _gdal.Rmdir(*args)
1369
1371 """MkdirRecursive(char const * utf8_path, int mode) -> VSI_RETVAL"""
1372 return _gdal.MkdirRecursive(*args)
1373
1375 """RmdirRecursive(char const * utf8_path) -> VSI_RETVAL"""
1376 return _gdal.RmdirRecursive(*args)
1377
1379 """Rename(char const * pszOld, char const * pszNew) -> VSI_RETVAL"""
1380 return _gdal.Rename(*args)
1381
1383 """GetActualURL(char const * utf8_path) -> char const *"""
1384 return _gdal.GetActualURL(*args)
1385
1387 """GetSignedURL(char const * utf8_path, char ** options=None) -> retStringAndCPLFree *"""
1388 return _gdal.GetSignedURL(*args)
1389
1393
1395 """GetFileSystemOptions(char const * utf8_path) -> char const *"""
1396 return _gdal.GetFileSystemOptions(*args)
1397
1398 _gdal.VSI_STAT_EXISTS_FLAG_swigconstant(_gdal)
1399 VSI_STAT_EXISTS_FLAG = _gdal.VSI_STAT_EXISTS_FLAG
1400
1401 _gdal.VSI_STAT_NATURE_FLAG_swigconstant(_gdal)
1402 VSI_STAT_NATURE_FLAG = _gdal.VSI_STAT_NATURE_FLAG
1403
1404 _gdal.VSI_STAT_SIZE_FLAG_swigconstant(_gdal)
1405 VSI_STAT_SIZE_FLAG = _gdal.VSI_STAT_SIZE_FLAG
1407 """Proxy of C++ StatBuf class."""
1408
1409 __swig_setmethods__ = {}
1410 __setattr__ = lambda self, name, value: _swig_setattr(self, StatBuf, name, value)
1411 __swig_getmethods__ = {}
1412 __getattr__ = lambda self, name: _swig_getattr(self, StatBuf, name)
1413 __repr__ = _swig_repr
1414 __swig_getmethods__["mode"] = _gdal.StatBuf_mode_get
1415 if _newclass:
1416 mode = _swig_property(_gdal.StatBuf_mode_get)
1417 __swig_getmethods__["size"] = _gdal.StatBuf_size_get
1418 if _newclass:
1419 size = _swig_property(_gdal.StatBuf_size_get)
1420 __swig_getmethods__["mtime"] = _gdal.StatBuf_mtime_get
1421 if _newclass:
1422 mtime = _swig_property(_gdal.StatBuf_mtime_get)
1423
1425 """__init__(StatBuf self, StatBuf psStatBuf) -> StatBuf"""
1426 this = _gdal.new_StatBuf(*args)
1427 try:
1428 self.this.append(this)
1429 except Exception:
1430 self.this = this
1431 __swig_destroy__ = _gdal.delete_StatBuf
1432 __del__ = lambda self: None
1433
1435 """IsDirectory(StatBuf self) -> int"""
1436 return _gdal.StatBuf_IsDirectory(self, *args)
1437
1438 StatBuf_swigregister = _gdal.StatBuf_swigregister
1439 StatBuf_swigregister(StatBuf)
1440
1441
1443 """VSIStatL(char const * utf8_path, int nFlags=0) -> int"""
1444 return _gdal.VSIStatL(*args)
1445
1447 """VSIFOpenL(char const * utf8_path, char const * pszMode) -> VSILFILE *"""
1448 return _gdal.VSIFOpenL(*args)
1449
1451 """VSIFOpenExL(char const * utf8_path, char const * pszMode, int bSetError) -> VSILFILE *"""
1452 return _gdal.VSIFOpenExL(*args)
1453
1455 """VSIFEofL(VSILFILE * fp) -> int"""
1456 return _gdal.VSIFEofL(*args)
1457
1459 """VSIFCloseL(VSILFILE * fp) -> VSI_RETVAL"""
1460 return _gdal.VSIFCloseL(*args)
1461
1463 """VSIFSeekL(VSILFILE * fp, GIntBig offset, int whence) -> int"""
1464 return _gdal.VSIFSeekL(*args)
1465
1467 """VSIFTellL(VSILFILE * fp) -> GIntBig"""
1468 return _gdal.VSIFTellL(*args)
1469
1471 """VSIFTruncateL(VSILFILE * fp, GIntBig length) -> int"""
1472 return _gdal.VSIFTruncateL(*args)
1473
1475 """VSISupportsSparseFiles(char const * utf8_path) -> int"""
1476 return _gdal.VSISupportsSparseFiles(*args)
1477
1478 _gdal.VSI_RANGE_STATUS_UNKNOWN_swigconstant(_gdal)
1479 VSI_RANGE_STATUS_UNKNOWN = _gdal.VSI_RANGE_STATUS_UNKNOWN
1480
1481 _gdal.VSI_RANGE_STATUS_DATA_swigconstant(_gdal)
1482 VSI_RANGE_STATUS_DATA = _gdal.VSI_RANGE_STATUS_DATA
1483
1484 _gdal.VSI_RANGE_STATUS_HOLE_swigconstant(_gdal)
1485 VSI_RANGE_STATUS_HOLE = _gdal.VSI_RANGE_STATUS_HOLE
1486
1488 """VSIFGetRangeStatusL(VSILFILE * fp, GIntBig offset, GIntBig length) -> int"""
1489 return _gdal.VSIFGetRangeStatusL(*args)
1490
1492 """VSIFWriteL(int nLen, int size, int memb, VSILFILE * fp) -> int"""
1493 return _gdal.VSIFWriteL(*args)
1494
1498
1500 """ParseCommandLine(char const * utf8_path) -> char **"""
1501 return _gdal.ParseCommandLine(*args)
1503 """Proxy of C++ GDALMajorObjectShadow class."""
1504
1505 __swig_setmethods__ = {}
1506 __setattr__ = lambda self, name, value: _swig_setattr(self, MajorObject, name, value)
1507 __swig_getmethods__ = {}
1508 __getattr__ = lambda self, name: _swig_getattr(self, MajorObject, name)
1509
1511 raise AttributeError("No constructor defined")
1512 __repr__ = _swig_repr
1513
1515 """GetDescription(MajorObject self) -> char const *"""
1516 return _gdal.MajorObject_GetDescription(self, *args)
1517
1518
1520 """SetDescription(MajorObject self, char const * pszNewDesc)"""
1521 return _gdal.MajorObject_SetDescription(self, *args)
1522
1523
1525 """GetMetadataDomainList(MajorObject self) -> char **"""
1526 return _gdal.MajorObject_GetMetadataDomainList(self, *args)
1527
1528
1532
1533
1537
1538
1545
1546
1550
1551
1555
1556
1561
1562 MajorObject_swigregister = _gdal.MajorObject_swigregister
1563 MajorObject_swigregister(MajorObject)
1564
1566 """Proxy of C++ GDALDriverShadow class."""
1567
1568 __swig_setmethods__ = {}
1569 for _s in [MajorObject]:
1570 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
1571 __setattr__ = lambda self, name, value: _swig_setattr(self, Driver, name, value)
1572 __swig_getmethods__ = {}
1573 for _s in [MajorObject]:
1574 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
1575 __getattr__ = lambda self, name: _swig_getattr(self, Driver, name)
1576
1578 raise AttributeError("No constructor defined")
1579 __repr__ = _swig_repr
1580 __swig_getmethods__["ShortName"] = _gdal.Driver_ShortName_get
1581 if _newclass:
1582 ShortName = _swig_property(_gdal.Driver_ShortName_get)
1583 __swig_getmethods__["LongName"] = _gdal.Driver_LongName_get
1584 if _newclass:
1585 LongName = _swig_property(_gdal.Driver_LongName_get)
1586 __swig_getmethods__["HelpTopic"] = _gdal.Driver_HelpTopic_get
1587 if _newclass:
1588 HelpTopic = _swig_property(_gdal.Driver_HelpTopic_get)
1589
1590 - def Create(self, *args, **kwargs):
1591 """Create(Driver self, char const * utf8_path, int xsize, int ysize, int bands=1, GDALDataType eType, char ** options=None) -> Dataset"""
1592 return _gdal.Driver_Create(self, *args, **kwargs)
1593
1594
1596 """CreateCopy(Driver self, char const * utf8_path, Dataset src, int strict=1, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
1597 return _gdal.Driver_CreateCopy(self, *args, **kwargs)
1598
1599
1601 """Delete(Driver self, char const * utf8_path) -> CPLErr"""
1602 return _gdal.Driver_Delete(self, *args)
1603
1604
1606 """Rename(Driver self, char const * newName, char const * oldName) -> CPLErr"""
1607 return _gdal.Driver_Rename(self, *args)
1608
1609
1611 """CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr"""
1612 return _gdal.Driver_CopyFiles(self, *args)
1613
1614
1616 """Register(Driver self) -> int"""
1617 return _gdal.Driver_Register(self, *args)
1618
1619
1621 """Deregister(Driver self)"""
1622 return _gdal.Driver_Deregister(self, *args)
1623
1624 Driver_swigregister = _gdal.Driver_swigregister
1625 Driver_swigregister(Driver)
1626
1627 import ogr
1628 import osr
1629 -class ColorEntry(_object):
1630 """Proxy of C++ GDALColorEntry class."""
1631
1632 __swig_setmethods__ = {}
1633 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorEntry, name, value)
1634 __swig_getmethods__ = {}
1635 __getattr__ = lambda self, name: _swig_getattr(self, ColorEntry, name)
1636
1637 - def __init__(self, *args, **kwargs):
1638 raise AttributeError("No constructor defined")
1639 __repr__ = _swig_repr
1640 __swig_setmethods__["c1"] = _gdal.ColorEntry_c1_set
1641 __swig_getmethods__["c1"] = _gdal.ColorEntry_c1_get
1642 if _newclass:
1643 c1 = _swig_property(_gdal.ColorEntry_c1_get, _gdal.ColorEntry_c1_set)
1644 __swig_setmethods__["c2"] = _gdal.ColorEntry_c2_set
1645 __swig_getmethods__["c2"] = _gdal.ColorEntry_c2_get
1646 if _newclass:
1647 c2 = _swig_property(_gdal.ColorEntry_c2_get, _gdal.ColorEntry_c2_set)
1648 __swig_setmethods__["c3"] = _gdal.ColorEntry_c3_set
1649 __swig_getmethods__["c3"] = _gdal.ColorEntry_c3_get
1650 if _newclass:
1651 c3 = _swig_property(_gdal.ColorEntry_c3_get, _gdal.ColorEntry_c3_set)
1652 __swig_setmethods__["c4"] = _gdal.ColorEntry_c4_set
1653 __swig_getmethods__["c4"] = _gdal.ColorEntry_c4_get
1654 if _newclass:
1655 c4 = _swig_property(_gdal.ColorEntry_c4_get, _gdal.ColorEntry_c4_set)
1656 ColorEntry_swigregister = _gdal.ColorEntry_swigregister
1657 ColorEntry_swigregister(ColorEntry)
1658
1659 -class GCP(_object):
1660 """Proxy of C++ GDAL_GCP class."""
1661
1662 __swig_setmethods__ = {}
1663 __setattr__ = lambda self, name, value: _swig_setattr(self, GCP, name, value)
1664 __swig_getmethods__ = {}
1665 __getattr__ = lambda self, name: _swig_getattr(self, GCP, name)
1666 __repr__ = _swig_repr
1667 __swig_setmethods__["GCPX"] = _gdal.GCP_GCPX_set
1668 __swig_getmethods__["GCPX"] = _gdal.GCP_GCPX_get
1669 if _newclass:
1670 GCPX = _swig_property(_gdal.GCP_GCPX_get, _gdal.GCP_GCPX_set)
1671 __swig_setmethods__["GCPY"] = _gdal.GCP_GCPY_set
1672 __swig_getmethods__["GCPY"] = _gdal.GCP_GCPY_get
1673 if _newclass:
1674 GCPY = _swig_property(_gdal.GCP_GCPY_get, _gdal.GCP_GCPY_set)
1675 __swig_setmethods__["GCPZ"] = _gdal.GCP_GCPZ_set
1676 __swig_getmethods__["GCPZ"] = _gdal.GCP_GCPZ_get
1677 if _newclass:
1678 GCPZ = _swig_property(_gdal.GCP_GCPZ_get, _gdal.GCP_GCPZ_set)
1679 __swig_setmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_set
1680 __swig_getmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_get
1681 if _newclass:
1682 GCPPixel = _swig_property(_gdal.GCP_GCPPixel_get, _gdal.GCP_GCPPixel_set)
1683 __swig_setmethods__["GCPLine"] = _gdal.GCP_GCPLine_set
1684 __swig_getmethods__["GCPLine"] = _gdal.GCP_GCPLine_get
1685 if _newclass:
1686 GCPLine = _swig_property(_gdal.GCP_GCPLine_get, _gdal.GCP_GCPLine_set)
1687 __swig_setmethods__["Info"] = _gdal.GCP_Info_set
1688 __swig_getmethods__["Info"] = _gdal.GCP_Info_get
1689 if _newclass:
1690 Info = _swig_property(_gdal.GCP_Info_get, _gdal.GCP_Info_set)
1691 __swig_setmethods__["Id"] = _gdal.GCP_Id_set
1692 __swig_getmethods__["Id"] = _gdal.GCP_Id_get
1693 if _newclass:
1694 Id = _swig_property(_gdal.GCP_Id_get, _gdal.GCP_Id_set)
1695
1697 """__init__(GDAL_GCP self, double x=0.0, double y=0.0, double z=0.0, double pixel=0.0, double line=0.0, char const * info, char const * id) -> GCP"""
1698 this = _gdal.new_GCP(*args)
1699 try:
1700 self.this.append(this)
1701 except Exception:
1702 self.this = this
1703 __swig_destroy__ = _gdal.delete_GCP
1704 __del__ = lambda self: None
1705
1707 str = '%s (%.2fP,%.2fL) -> (%.7fE,%.7fN,%.2f) %s '\
1708 % (self.Id, self.GCPPixel, self.GCPLine,
1709 self.GCPX, self.GCPY, self.GCPZ, self.Info )
1710 return str
1711
1713 base = [CXT_Element,'GCP']
1714 base.append([CXT_Attribute,'Id',[CXT_Text,self.Id]])
1715 pixval = '%0.15E' % self.GCPPixel
1716 lineval = '%0.15E' % self.GCPLine
1717 xval = '%0.15E' % self.GCPX
1718 yval = '%0.15E' % self.GCPY
1719 zval = '%0.15E' % self.GCPZ
1720 base.append([CXT_Attribute,'Pixel',[CXT_Text,pixval]])
1721 base.append([CXT_Attribute,'Line',[CXT_Text,lineval]])
1722 base.append([CXT_Attribute,'X',[CXT_Text,xval]])
1723 base.append([CXT_Attribute,'Y',[CXT_Text,yval]])
1724 if with_Z:
1725 base.append([CXT_Attribute,'Z',[CXT_Text,zval]])
1726 return base
1727
1728 GCP_swigregister = _gdal.GCP_swigregister
1729 GCP_swigregister(GCP)
1730
1731
1733 """GDAL_GCP_GCPX_get(GCP gcp) -> double"""
1734 return _gdal.GDAL_GCP_GCPX_get(*args)
1735
1737 """GDAL_GCP_GCPX_set(GCP gcp, double dfGCPX)"""
1738 return _gdal.GDAL_GCP_GCPX_set(*args)
1739
1741 """GDAL_GCP_GCPY_get(GCP gcp) -> double"""
1742 return _gdal.GDAL_GCP_GCPY_get(*args)
1743
1745 """GDAL_GCP_GCPY_set(GCP gcp, double dfGCPY)"""
1746 return _gdal.GDAL_GCP_GCPY_set(*args)
1747
1749 """GDAL_GCP_GCPZ_get(GCP gcp) -> double"""
1750 return _gdal.GDAL_GCP_GCPZ_get(*args)
1751
1753 """GDAL_GCP_GCPZ_set(GCP gcp, double dfGCPZ)"""
1754 return _gdal.GDAL_GCP_GCPZ_set(*args)
1755
1759
1761 """GDAL_GCP_GCPPixel_set(GCP gcp, double dfGCPPixel)"""
1762 return _gdal.GDAL_GCP_GCPPixel_set(*args)
1763
1767
1769 """GDAL_GCP_GCPLine_set(GCP gcp, double dfGCPLine)"""
1770 return _gdal.GDAL_GCP_GCPLine_set(*args)
1771
1773 """GDAL_GCP_Info_get(GCP gcp) -> char const *"""
1774 return _gdal.GDAL_GCP_Info_get(*args)
1775
1777 """GDAL_GCP_Info_set(GCP gcp, char const * pszInfo)"""
1778 return _gdal.GDAL_GCP_Info_set(*args)
1779
1781 """GDAL_GCP_Id_get(GCP gcp) -> char const *"""
1782 return _gdal.GDAL_GCP_Id_get(*args)
1783
1785 """GDAL_GCP_Id_set(GCP gcp, char const * pszId)"""
1786 return _gdal.GDAL_GCP_Id_set(*args)
1787
1792 """Proxy of C++ CPLVirtualMemShadow class."""
1793
1794 __swig_setmethods__ = {}
1795 __setattr__ = lambda self, name, value: _swig_setattr(self, VirtualMem, name, value)
1796 __swig_getmethods__ = {}
1797 __getattr__ = lambda self, name: _swig_getattr(self, VirtualMem, name)
1798
1800 raise AttributeError("No constructor defined")
1801 __repr__ = _swig_repr
1802 __swig_destroy__ = _gdal.delete_VirtualMem
1803 __del__ = lambda self: None
1804
1806 """GetAddr(VirtualMem self)"""
1807 return _gdal.VirtualMem_GetAddr(self, *args)
1808
1809
1810 - def Pin(self, *args):
1811 """Pin(VirtualMem self, size_t start_offset=0, size_t nsize=0, int bWriteOp=0)"""
1812 return _gdal.VirtualMem_Pin(self, *args)
1813
1814 VirtualMem_swigregister = _gdal.VirtualMem_swigregister
1815 VirtualMem_swigregister(VirtualMem)
1816
1818 """Proxy of C++ GDALAsyncReaderShadow class."""
1819
1820 __swig_setmethods__ = {}
1821 __setattr__ = lambda self, name, value: _swig_setattr(self, AsyncReader, name, value)
1822 __swig_getmethods__ = {}
1823 __getattr__ = lambda self, name: _swig_getattr(self, AsyncReader, name)
1824
1826 raise AttributeError("No constructor defined")
1827 __repr__ = _swig_repr
1828 __swig_destroy__ = _gdal.delete_AsyncReader
1829 __del__ = lambda self: None
1830
1832 """GetNextUpdatedRegion(AsyncReader self, double timeout) -> GDALAsyncStatusType"""
1833 return _gdal.AsyncReader_GetNextUpdatedRegion(self, *args)
1834
1835
1837 """GetBuffer(AsyncReader self)"""
1838 return _gdal.AsyncReader_GetBuffer(self, *args)
1839
1840
1842 """LockBuffer(AsyncReader self, double timeout) -> int"""
1843 return _gdal.AsyncReader_LockBuffer(self, *args)
1844
1845
1847 """UnlockBuffer(AsyncReader self)"""
1848 return _gdal.AsyncReader_UnlockBuffer(self, *args)
1849
1850 AsyncReader_swigregister = _gdal.AsyncReader_swigregister
1851 AsyncReader_swigregister(AsyncReader)
1852
1854 """Proxy of C++ GDALDatasetShadow class."""
1855
1856 __swig_setmethods__ = {}
1857 for _s in [MajorObject]:
1858 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
1859 __setattr__ = lambda self, name, value: _swig_setattr(self, Dataset, name, value)
1860 __swig_getmethods__ = {}
1861 for _s in [MajorObject]:
1862 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
1863 __getattr__ = lambda self, name: _swig_getattr(self, Dataset, name)
1864
1866 raise AttributeError("No constructor defined")
1867 __repr__ = _swig_repr
1868 __swig_getmethods__["RasterXSize"] = _gdal.Dataset_RasterXSize_get
1869 if _newclass:
1870 RasterXSize = _swig_property(_gdal.Dataset_RasterXSize_get)
1871 __swig_getmethods__["RasterYSize"] = _gdal.Dataset_RasterYSize_get
1872 if _newclass:
1873 RasterYSize = _swig_property(_gdal.Dataset_RasterYSize_get)
1874 __swig_getmethods__["RasterCount"] = _gdal.Dataset_RasterCount_get
1875 if _newclass:
1876 RasterCount = _swig_property(_gdal.Dataset_RasterCount_get)
1877 __swig_destroy__ = _gdal.delete_Dataset
1878 __del__ = lambda self: None
1879
1881 """GetDriver(Dataset self) -> Driver"""
1882 return _gdal.Dataset_GetDriver(self, *args)
1883
1884
1886 """GetRasterBand(Dataset self, int nBand) -> Band"""
1887 return _gdal.Dataset_GetRasterBand(self, *args)
1888
1889
1891 """GetProjection(Dataset self) -> char const *"""
1892 return _gdal.Dataset_GetProjection(self, *args)
1893
1894
1896 """GetProjectionRef(Dataset self) -> char const *"""
1897 return _gdal.Dataset_GetProjectionRef(self, *args)
1898
1899
1901 """SetProjection(Dataset self, char const * prj) -> CPLErr"""
1902 return _gdal.Dataset_SetProjection(self, *args)
1903
1904
1908
1909
1913
1914
1916 """BuildOverviews(Dataset self, char const * resampling, int overviewlist=0, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
1917 return _gdal.Dataset_BuildOverviews(self, *args, **kwargs)
1918
1919
1921 """GetGCPCount(Dataset self) -> int"""
1922 return _gdal.Dataset_GetGCPCount(self, *args)
1923
1924
1926 """GetGCPProjection(Dataset self) -> char const *"""
1927 return _gdal.Dataset_GetGCPProjection(self, *args)
1928
1929
1931 """GetGCPs(Dataset self)"""
1932 return _gdal.Dataset_GetGCPs(self, *args)
1933
1934
1936 """SetGCPs(Dataset self, int nGCPs, char const * pszGCPProjection) -> CPLErr"""
1937 return _gdal.Dataset_SetGCPs(self, *args)
1938
1939
1941 """FlushCache(Dataset self)"""
1942 return _gdal.Dataset_FlushCache(self, *args)
1943
1944
1945 - def AddBand(self, *args, **kwargs):
1946 """AddBand(Dataset self, GDALDataType datatype, char ** options=None) -> CPLErr"""
1947 return _gdal.Dataset_AddBand(self, *args, **kwargs)
1948
1949
1951 """CreateMaskBand(Dataset self, int nFlags) -> CPLErr"""
1952 return _gdal.Dataset_CreateMaskBand(self, *args)
1953
1954
1956 """GetFileList(Dataset self) -> char **"""
1957 return _gdal.Dataset_GetFileList(self, *args)
1958
1959
1961 """WriteRaster(Dataset self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None, int * buf_ysize=None, GDALDataType * buf_type=None, int band_list=0, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None, GIntBig * buf_band_space=None) -> CPLErr"""
1962 return _gdal.Dataset_WriteRaster(self, *args, **kwargs)
1963
1964
1966 """AdviseRead(Dataset self, int xoff, int yoff, int xsize, int ysize, int * buf_xsize=None, int * buf_ysize=None, GDALDataType * buf_type=None, int band_list=0, char ** options=None) -> CPLErr"""
1967 return _gdal.Dataset_AdviseRead(self, *args)
1968
1969
1971 """BeginAsyncReader(Dataset self, int xOff, int yOff, int xSize, int ySize, int buf_len, int buf_xsize, int buf_ysize, GDALDataType bufType, int band_list=0, int nPixelSpace=0, int nLineSpace=0, int nBandSpace=0, char ** options=None) -> AsyncReader"""
1972 return _gdal.Dataset_BeginAsyncReader(self, *args, **kwargs)
1973
1974
1976 """EndAsyncReader(Dataset self, AsyncReader ario)"""
1977 return _gdal.Dataset_EndAsyncReader(self, *args)
1978
1979
1981 """GetVirtualMem(Dataset self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eBufType, int band_list, int bIsBandSequential, size_t nCacheSize, size_t nPageSizeHint, char ** options=None) -> VirtualMem"""
1982 return _gdal.Dataset_GetVirtualMem(self, *args, **kwargs)
1983
1984
1986 """GetTiledVirtualMem(Dataset self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nTileXSize, int nTileYSize, GDALDataType eBufType, int band_list, GDALTileOrganization eTileOrganization, size_t nCacheSize, char ** options=None) -> VirtualMem"""
1987 return _gdal.Dataset_GetTiledVirtualMem(self, *args, **kwargs)
1988
1989
1991 """CreateLayer(Dataset self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type, char ** options=None) -> Layer"""
1992 return _gdal.Dataset_CreateLayer(self, *args, **kwargs)
1993
1994
1996 """CopyLayer(Dataset self, Layer src_layer, char const * new_name, char ** options=None) -> Layer"""
1997 return _gdal.Dataset_CopyLayer(self, *args, **kwargs)
1998
1999
2001 """DeleteLayer(Dataset self, int index) -> OGRErr"""
2002 return _gdal.Dataset_DeleteLayer(self, *args)
2003
2004
2006 """GetLayerCount(Dataset self) -> int"""
2007 return _gdal.Dataset_GetLayerCount(self, *args)
2008
2009
2011 """GetLayerByIndex(Dataset self, int index=0) -> Layer"""
2012 return _gdal.Dataset_GetLayerByIndex(self, *args)
2013
2014
2016 """GetLayerByName(Dataset self, char const * layer_name) -> Layer"""
2017 return _gdal.Dataset_GetLayerByName(self, *args)
2018
2019
2021 """ResetReading(Dataset self)"""
2022 return _gdal.Dataset_ResetReading(self, *args)
2023
2024
2026 """GetNextFeature(Dataset self, bool include_layer=True, bool include_pct=False, GDALProgressFunc callback=0, void * callback_data=None) -> Feature"""
2027 return _gdal.Dataset_GetNextFeature(self, *args, **kwargs)
2028
2029
2031 """TestCapability(Dataset self, char const * cap) -> bool"""
2032 return _gdal.Dataset_TestCapability(self, *args)
2033
2034
2036 """ExecuteSQL(Dataset self, char const * statement, Geometry spatialFilter=None, char const * dialect) -> Layer"""
2037 return _gdal.Dataset_ExecuteSQL(self, *args, **kwargs)
2038
2039
2041 """ReleaseResultSet(Dataset self, Layer layer)"""
2042 return _gdal.Dataset_ReleaseResultSet(self, *args)
2043
2044
2046 """GetStyleTable(Dataset self) -> StyleTable"""
2047 return _gdal.Dataset_GetStyleTable(self, *args)
2048
2049
2051 """SetStyleTable(Dataset self, StyleTable table)"""
2052 return _gdal.Dataset_SetStyleTable(self, *args)
2053
2054
2056 """StartTransaction(Dataset self, int force=False) -> OGRErr"""
2057 return _gdal.Dataset_StartTransaction(self, *args, **kwargs)
2058
2059
2061 """CommitTransaction(Dataset self) -> OGRErr"""
2062 return _gdal.Dataset_CommitTransaction(self, *args)
2063
2064
2066 """RollbackTransaction(Dataset self) -> OGRErr"""
2067 return _gdal.Dataset_RollbackTransaction(self, *args)
2068
2069
2071 """ReadRaster1(Dataset self, int xoff, int yoff, int xsize, int ysize, int * buf_xsize=None, int * buf_ysize=None, GDALDataType * buf_type=None, int band_list=0, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None, GIntBig * buf_band_space=None, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
2072 return _gdal.Dataset_ReadRaster1(self, *args, **kwargs)
2073
2074
2075
2076 - def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None, buf_obj=None,
2077 buf_xsize = None, buf_ysize = None, buf_type = None,
2078 resample_alg = GRIORA_NearestNeighbour,
2079 callback = None,
2080 callback_data = None):
2081 """ Reading a chunk of a GDAL band into a numpy array. The optional (buf_xsize,buf_ysize,buf_type)
2082 parameters should generally not be specified if buf_obj is specified. The array is returned"""
2083
2084 import gdalnumeric
2085 return gdalnumeric.DatasetReadAsArray( self, xoff, yoff, xsize, ysize, buf_obj,
2086 buf_xsize, buf_ysize, buf_type,
2087 resample_alg = resample_alg,
2088 callback = callback,
2089 callback_data = callback_data )
2090
2091 - def WriteRaster(self, xoff, yoff, xsize, ysize,
2092 buf_string,
2093 buf_xsize = None, buf_ysize = None, buf_type = None,
2094 band_list = None,
2095 buf_pixel_space = None, buf_line_space = None, buf_band_space = None ):
2096
2097 if buf_xsize is None:
2098 buf_xsize = xsize;
2099 if buf_ysize is None:
2100 buf_ysize = ysize;
2101 if band_list is None:
2102 band_list = range(1,self.RasterCount+1)
2103 if buf_type is None:
2104 buf_type = self.GetRasterBand(1).DataType
2105
2106 return _gdal.Dataset_WriteRaster(self,
2107 xoff, yoff, xsize, ysize,
2108 buf_string, buf_xsize, buf_ysize, buf_type, band_list,
2109 buf_pixel_space, buf_line_space, buf_band_space )
2110
2111 - def ReadRaster(self, xoff = 0, yoff = 0, xsize = None, ysize = None,
2112 buf_xsize = None, buf_ysize = None, buf_type = None,
2113 band_list = None,
2114 buf_pixel_space = None, buf_line_space = None, buf_band_space = None,
2115 resample_alg = GRIORA_NearestNeighbour,
2116 callback = None,
2117 callback_data = None):
2118
2119 if xsize is None:
2120 xsize = self.RasterXSize
2121 if ysize is None:
2122 ysize = self.RasterYSize
2123 if band_list is None:
2124 band_list = range(1,self.RasterCount+1)
2125 if buf_xsize is None:
2126 buf_xsize = xsize;
2127 if buf_ysize is None:
2128 buf_ysize = ysize;
2129
2130 if buf_type is None:
2131 buf_type = self.GetRasterBand(1).DataType;
2132
2133 return _gdal.Dataset_ReadRaster1(self, xoff, yoff, xsize, ysize,
2134 buf_xsize, buf_ysize, buf_type,
2135 band_list, buf_pixel_space, buf_line_space, buf_band_space,
2136 resample_alg, callback, callback_data )
2137
2138 - def GetVirtualMemArray(self, eAccess = gdalconst.GF_Read, xoff=0, yoff=0,
2139 xsize=None, ysize=None, bufxsize=None, bufysize=None,
2140 datatype = None, band_list = None, band_sequential = True,
2141 cache_size = 10 * 1024 * 1024, page_size_hint = 0,
2142 options = None):
2143 """Return a NumPy array for the dataset, seen as a virtual memory mapping.
2144 If there are several bands and band_sequential = True, an element is
2145 accessed with array[band][y][x].
2146 If there are several bands and band_sequential = False, an element is
2147 accessed with array[y][x][band].
2148 If there is only one band, an element is accessed with array[y][x].
2149 Any reference to the array must be dropped before the last reference to the
2150 related dataset is also dropped.
2151 """
2152 import gdalnumeric
2153 if xsize is None:
2154 xsize = self.RasterXSize
2155 if ysize is None:
2156 ysize = self.RasterYSize
2157 if bufxsize is None:
2158 bufxsize = self.RasterXSize
2159 if bufysize is None:
2160 bufysize = self.RasterYSize
2161 if datatype is None:
2162 datatype = self.GetRasterBand(1).DataType
2163 if band_list is None:
2164 band_list = range(1,self.RasterCount+1)
2165 if options is None:
2166 virtualmem = self.GetVirtualMem(eAccess,xoff,yoff,xsize,ysize,bufxsize,bufysize,datatype,band_list,band_sequential,cache_size,page_size_hint)
2167 else:
2168 virtualmem = self.GetVirtualMem(eAccess,xoff,yoff,xsize,ysize,bufxsize,bufysize,datatype,band_list,band_sequential,cache_size,page_size_hint, options)
2169 return gdalnumeric.VirtualMemGetArray( virtualmem )
2170
2171 - def GetTiledVirtualMemArray(self, eAccess = gdalconst.GF_Read, xoff=0, yoff=0,
2172 xsize=None, ysize=None, tilexsize=256, tileysize=256,
2173 datatype = None, band_list = None, tile_organization = gdalconst.GTO_BSQ,
2174 cache_size = 10 * 1024 * 1024, options = None):
2175 """Return a NumPy array for the dataset, seen as a virtual memory mapping with
2176 a tile organization.
2177 If there are several bands and tile_organization = gdal.GTO_TIP, an element is
2178 accessed with array[tiley][tilex][y][x][band].
2179 If there are several bands and tile_organization = gdal.GTO_BIT, an element is
2180 accessed with array[tiley][tilex][band][y][x].
2181 If there are several bands and tile_organization = gdal.GTO_BSQ, an element is
2182 accessed with array[band][tiley][tilex][y][x].
2183 If there is only one band, an element is accessed with array[tiley][tilex][y][x].
2184 Any reference to the array must be dropped before the last reference to the
2185 related dataset is also dropped.
2186 """
2187 import gdalnumeric
2188 if xsize is None:
2189 xsize = self.RasterXSize
2190 if ysize is None:
2191 ysize = self.RasterYSize
2192 if datatype is None:
2193 datatype = self.GetRasterBand(1).DataType
2194 if band_list is None:
2195 band_list = range(1,self.RasterCount+1)
2196 if options is None:
2197 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,band_list,tile_organization,cache_size)
2198 else:
2199 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,band_list,tile_organization,cache_size, options)
2200 return gdalnumeric.VirtualMemGetArray( virtualmem )
2201
2203 sd_list = []
2204
2205 sd = self.GetMetadata('SUBDATASETS')
2206 if sd is None:
2207 return sd_list
2208
2209 i = 1
2210 while 'SUBDATASET_'+str(i)+'_NAME' in sd:
2211 sd_list.append( ( sd['SUBDATASET_'+str(i)+'_NAME'],
2212 sd['SUBDATASET_'+str(i)+'_DESC'] ) )
2213 i = i + 1
2214 return sd_list
2215
2216 - def BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj = None, buf_xsize = None, buf_ysize = None, buf_type = None, band_list = None, options=[]):
2217 if band_list is None:
2218 band_list = range(1, self.RasterCount + 1)
2219 if buf_xsize is None:
2220 buf_xsize = 0;
2221 if buf_ysize is None:
2222 buf_ysize = 0;
2223 if buf_type is None:
2224 buf_type = GDT_Byte
2225
2226 if buf_xsize <= 0:
2227 buf_xsize = xsize
2228 if buf_ysize <= 0:
2229 buf_ysize = ysize
2230
2231 if buf_obj is None:
2232 from sys import version_info
2233 nRequiredSize = int(buf_xsize * buf_ysize * len(band_list) * (_gdal.GetDataTypeSize(buf_type) / 8))
2234 if version_info >= (3,0,0):
2235 buf_obj_ar = [ None ]
2236 exec("buf_obj_ar[0] = b' ' * nRequiredSize")
2237 buf_obj = buf_obj_ar[0]
2238 else:
2239 buf_obj = ' ' * nRequiredSize
2240 return _gdal.Dataset_BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj, buf_xsize, buf_ysize, buf_type, band_list, 0, 0, 0, options)
2241
2243 """Return the layer given an index or a name"""
2244 if isinstance(iLayer, str):
2245 return self.GetLayerByName(str(iLayer))
2246 elif isinstance(iLayer, int):
2247 return self.GetLayerByIndex(iLayer)
2248 else:
2249 raise TypeError("Input %s is not of String or Int type" % type(iLayer))
2250
2252 """Deletes the layer given an index or layer name"""
2253 if isinstance(value, str):
2254 for i in range(self.GetLayerCount()):
2255 name = self.GetLayer(i).GetName()
2256 if name == value:
2257 return _gdal.Dataset_DeleteLayer(self, i)
2258 raise ValueError("Layer %s not found to delete" % value)
2259 elif isinstance(value, int):
2260 return _gdal.Dataset_DeleteLayer(self, value)
2261 else:
2262 raise TypeError("Input %s is not of String or Int type" % type(value))
2263
2264 Dataset_swigregister = _gdal.Dataset_swigregister
2265 Dataset_swigregister(Dataset)
2266
2267 -class Band(MajorObject):
2268 """Proxy of C++ GDALRasterBandShadow class."""
2269
2270 __swig_setmethods__ = {}
2271 for _s in [MajorObject]:
2272 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
2273 __setattr__ = lambda self, name, value: _swig_setattr(self, Band, name, value)
2274 __swig_getmethods__ = {}
2275 for _s in [MajorObject]:
2276 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
2277 __getattr__ = lambda self, name: _swig_getattr(self, Band, name)
2278
2280 raise AttributeError("No constructor defined")
2281 __repr__ = _swig_repr
2282 __swig_getmethods__["XSize"] = _gdal.Band_XSize_get
2283 if _newclass:
2284 XSize = _swig_property(_gdal.Band_XSize_get)
2285 __swig_getmethods__["YSize"] = _gdal.Band_YSize_get
2286 if _newclass:
2287 YSize = _swig_property(_gdal.Band_YSize_get)
2288 __swig_getmethods__["DataType"] = _gdal.Band_DataType_get
2289 if _newclass:
2290 DataType = _swig_property(_gdal.Band_DataType_get)
2291
2293 """GetDataset(Band self) -> Dataset"""
2294 return _gdal.Band_GetDataset(self, *args)
2295
2296
2298 """GetBand(Band self) -> int"""
2299 return _gdal.Band_GetBand(self, *args)
2300
2301
2303 """GetBlockSize(Band self)"""
2304 return _gdal.Band_GetBlockSize(self, *args)
2305
2306
2308 """GetActualBlockSize(Band self, int nXBlockOff, int nYBlockOff)"""
2309 return _gdal.Band_GetActualBlockSize(self, *args)
2310
2311
2313 """GetColorInterpretation(Band self) -> GDALColorInterp"""
2314 return _gdal.Band_GetColorInterpretation(self, *args)
2315
2316
2318 """GetRasterColorInterpretation(Band self) -> GDALColorInterp"""
2319 return _gdal.Band_GetRasterColorInterpretation(self, *args)
2320
2321
2323 """SetColorInterpretation(Band self, GDALColorInterp val) -> CPLErr"""
2324 return _gdal.Band_SetColorInterpretation(self, *args)
2325
2326
2328 """SetRasterColorInterpretation(Band self, GDALColorInterp val) -> CPLErr"""
2329 return _gdal.Band_SetRasterColorInterpretation(self, *args)
2330
2331
2333 """GetNoDataValue(Band self)"""
2334 return _gdal.Band_GetNoDataValue(self, *args)
2335
2336
2338 """SetNoDataValue(Band self, double d) -> CPLErr"""
2339 return _gdal.Band_SetNoDataValue(self, *args)
2340
2341
2343 """DeleteNoDataValue(Band self) -> CPLErr"""
2344 return _gdal.Band_DeleteNoDataValue(self, *args)
2345
2346
2348 """GetUnitType(Band self) -> char const *"""
2349 return _gdal.Band_GetUnitType(self, *args)
2350
2351
2353 """SetUnitType(Band self, char const * val) -> CPLErr"""
2354 return _gdal.Band_SetUnitType(self, *args)
2355
2356
2358 """GetRasterCategoryNames(Band self) -> char **"""
2359 return _gdal.Band_GetRasterCategoryNames(self, *args)
2360
2361
2363 """SetRasterCategoryNames(Band self, char ** names) -> CPLErr"""
2364 return _gdal.Band_SetRasterCategoryNames(self, *args)
2365
2366
2368 """GetMinimum(Band self)"""
2369 return _gdal.Band_GetMinimum(self, *args)
2370
2371
2373 """GetMaximum(Band self)"""
2374 return _gdal.Band_GetMaximum(self, *args)
2375
2376
2378 """GetOffset(Band self)"""
2379 return _gdal.Band_GetOffset(self, *args)
2380
2381
2383 """GetScale(Band self)"""
2384 return _gdal.Band_GetScale(self, *args)
2385
2386
2388 """SetOffset(Band self, double val) -> CPLErr"""
2389 return _gdal.Band_SetOffset(self, *args)
2390
2391
2393 """SetScale(Band self, double val) -> CPLErr"""
2394 return _gdal.Band_SetScale(self, *args)
2395
2396
2398 """GetStatistics(Band self, int approx_ok, int force) -> CPLErr"""
2399 return _gdal.Band_GetStatistics(self, *args)
2400
2401
2403 """ComputeStatistics(Band self, bool approx_ok, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
2404 return _gdal.Band_ComputeStatistics(self, *args)
2405
2406
2408 """SetStatistics(Band self, double min, double max, double mean, double stddev) -> CPLErr"""
2409 return _gdal.Band_SetStatistics(self, *args)
2410
2411
2413 """GetOverviewCount(Band self) -> int"""
2414 return _gdal.Band_GetOverviewCount(self, *args)
2415
2416
2418 """GetOverview(Band self, int i) -> Band"""
2419 return _gdal.Band_GetOverview(self, *args)
2420
2421
2423 """Checksum(Band self, int xoff=0, int yoff=0, int * xsize=None, int * ysize=None) -> int"""
2424 return _gdal.Band_Checksum(self, *args, **kwargs)
2425
2426
2428 """ComputeRasterMinMax(Band self, int approx_ok=0)"""
2429 return _gdal.Band_ComputeRasterMinMax(self, *args)
2430
2431
2433 """ComputeBandStats(Band self, int samplestep=1)"""
2434 return _gdal.Band_ComputeBandStats(self, *args)
2435
2436
2437 - def Fill(self, *args):
2438 """Fill(Band self, double real_fill, double imag_fill=0.0) -> CPLErr"""
2439 return _gdal.Band_Fill(self, *args)
2440
2441
2443 """WriteRaster(Band self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None, int * buf_ysize=None, int * buf_type=None, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None) -> CPLErr"""
2444 return _gdal.Band_WriteRaster(self, *args, **kwargs)
2445
2446
2448 """FlushCache(Band self)"""
2449 return _gdal.Band_FlushCache(self, *args)
2450
2451
2453 """GetRasterColorTable(Band self) -> ColorTable"""
2454 return _gdal.Band_GetRasterColorTable(self, *args)
2455
2456
2458 """GetColorTable(Band self) -> ColorTable"""
2459 return _gdal.Band_GetColorTable(self, *args)
2460
2461
2463 """SetRasterColorTable(Band self, ColorTable arg) -> int"""
2464 return _gdal.Band_SetRasterColorTable(self, *args)
2465
2466
2468 """SetColorTable(Band self, ColorTable arg) -> int"""
2469 return _gdal.Band_SetColorTable(self, *args)
2470
2471
2473 """GetDefaultRAT(Band self) -> RasterAttributeTable"""
2474 return _gdal.Band_GetDefaultRAT(self, *args)
2475
2476
2478 """SetDefaultRAT(Band self, RasterAttributeTable table) -> int"""
2479 return _gdal.Band_SetDefaultRAT(self, *args)
2480
2481
2483 """GetMaskBand(Band self) -> Band"""
2484 return _gdal.Band_GetMaskBand(self, *args)
2485
2486
2488 """GetMaskFlags(Band self) -> int"""
2489 return _gdal.Band_GetMaskFlags(self, *args)
2490
2491
2493 """CreateMaskBand(Band self, int nFlags) -> CPLErr"""
2494 return _gdal.Band_CreateMaskBand(self, *args)
2495
2496
2498 """GetHistogram(Band self, double min=-0.5, double max=255.5, int buckets=256, int include_out_of_range=0, int approx_ok=1, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
2499 return _gdal.Band_GetHistogram(self, *args, **kwargs)
2500
2501
2503 """GetDefaultHistogram(Band self, double * min_ret=None, double * max_ret=None, int * buckets_ret=None, GUIntBig ** ppanHistogram=None, int force=1, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
2504 return _gdal.Band_GetDefaultHistogram(self, *args, **kwargs)
2505
2506
2508 """SetDefaultHistogram(Band self, double min, double max, int buckets_in) -> CPLErr"""
2509 return _gdal.Band_SetDefaultHistogram(self, *args)
2510
2511
2513 """HasArbitraryOverviews(Band self) -> bool"""
2514 return _gdal.Band_HasArbitraryOverviews(self, *args)
2515
2516
2518 """GetCategoryNames(Band self) -> char **"""
2519 return _gdal.Band_GetCategoryNames(self, *args)
2520
2521
2523 """SetCategoryNames(Band self, char ** papszCategoryNames) -> CPLErr"""
2524 return _gdal.Band_SetCategoryNames(self, *args)
2525
2526
2528 """GetVirtualMem(Band self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eBufType, size_t nCacheSize, size_t nPageSizeHint, char ** options=None) -> VirtualMem"""
2529 return _gdal.Band_GetVirtualMem(self, *args, **kwargs)
2530
2531
2533 """GetVirtualMemAuto(Band self, GDALRWFlag eRWFlag, char ** options=None) -> VirtualMem"""
2534 return _gdal.Band_GetVirtualMemAuto(self, *args, **kwargs)
2535
2536
2538 """GetTiledVirtualMem(Band self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nTileXSize, int nTileYSize, GDALDataType eBufType, size_t nCacheSize, char ** options=None) -> VirtualMem"""
2539 return _gdal.Band_GetTiledVirtualMem(self, *args, **kwargs)
2540
2541
2543 """GetDataCoverageStatus(Band self, int nXOff, int nYOff, int nXSize, int nYSize, int nMaskFlagStop=0) -> int"""
2544 return _gdal.Band_GetDataCoverageStatus(self, *args)
2545
2546
2548 """AdviseRead(Band self, int xoff, int yoff, int xsize, int ysize, int * buf_xsize=None, int * buf_ysize=None, GDALDataType * buf_type=None, char ** options=None) -> CPLErr"""
2549 return _gdal.Band_AdviseRead(self, *args)
2550
2551
2553 """ReadRaster1(Band self, double xoff, double yoff, double xsize, double ysize, int * buf_xsize=None, int * buf_ysize=None, int * buf_type=None, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
2554 return _gdal.Band_ReadRaster1(self, *args, **kwargs)
2555
2556
2558 """ReadBlock(Band self, int xoff, int yoff) -> CPLErr"""
2559 return _gdal.Band_ReadBlock(self, *args, **kwargs)
2560
2561
2562
2564 """ComputeStatistics(Band self, bool approx_ok, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
2565
2566
2567
2568 approx_ok = args[0]
2569 if approx_ok == 0:
2570 approx_ok = False
2571 elif approx_ok == 1:
2572 approx_ok = True
2573 new_args = [ approx_ok ]
2574 for arg in args[1:]:
2575 new_args.append( arg )
2576
2577 return _gdal.Band_ComputeStatistics(self, *new_args)
2578
2579
2580 - def ReadRaster(self, xoff = 0, yoff = 0, xsize = None, ysize = None,
2581 buf_xsize = None, buf_ysize = None, buf_type = None,
2582 buf_pixel_space = None, buf_line_space = None,
2583 resample_alg = GRIORA_NearestNeighbour,
2584 callback = None,
2585 callback_data = None):
2586
2587 if xsize is None:
2588 xsize = self.XSize
2589 if ysize is None:
2590 ysize = self.YSize
2591
2592 return _gdal.Band_ReadRaster1(self, xoff, yoff, xsize, ysize,
2593 buf_xsize, buf_ysize, buf_type,
2594 buf_pixel_space, buf_line_space,
2595 resample_alg, callback, callback_data)
2596
2597 - def ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None,
2598 buf_xsize=None, buf_ysize=None, buf_type=None, buf_obj=None,
2599 resample_alg = GRIORA_NearestNeighbour,
2600 callback = None,
2601 callback_data = None):
2602 """ Reading a chunk of a GDAL band into a numpy array. The optional (buf_xsize,buf_ysize,buf_type)
2603 parameters should generally not be specified if buf_obj is specified. The array is returned"""
2604
2605 import gdalnumeric
2606
2607 return gdalnumeric.BandReadAsArray( self, xoff, yoff,
2608 win_xsize, win_ysize,
2609 buf_xsize, buf_ysize, buf_type, buf_obj,
2610 resample_alg = resample_alg,
2611 callback = callback,
2612 callback_data = callback_data)
2613
2618 import gdalnumeric
2619
2620 return gdalnumeric.BandWriteArray( self, array, xoff, yoff,
2621 resample_alg = resample_alg,
2622 callback = callback,
2623 callback_data = callback_data )
2624
2625 - def GetVirtualMemArray(self, eAccess = gdalconst.GF_Read, xoff=0, yoff=0,
2626 xsize=None, ysize=None, bufxsize=None, bufysize=None,
2627 datatype = None,
2628 cache_size = 10 * 1024 * 1024, page_size_hint = 0,
2629 options = None):
2630 """Return a NumPy array for the band, seen as a virtual memory mapping.
2631 An element is accessed with array[y][x].
2632 Any reference to the array must be dropped before the last reference to the
2633 related dataset is also dropped.
2634 """
2635 import gdalnumeric
2636 if xsize is None:
2637 xsize = self.XSize
2638 if ysize is None:
2639 ysize = self.YSize
2640 if bufxsize is None:
2641 bufxsize = self.XSize
2642 if bufysize is None:
2643 bufysize = self.YSize
2644 if datatype is None:
2645 datatype = self.DataType
2646 if options is None:
2647 virtualmem = self.GetVirtualMem(eAccess,xoff,yoff,xsize,ysize,bufxsize,bufysize,datatype,cache_size,page_size_hint)
2648 else:
2649 virtualmem = self.GetVirtualMem(eAccess,xoff,yoff,xsize,ysize,bufxsize,bufysize,datatype,cache_size,page_size_hint,options)
2650 return gdalnumeric.VirtualMemGetArray( virtualmem )
2651
2653 """Return a NumPy array for the band, seen as a virtual memory mapping.
2654 An element is accessed with array[y][x].
2655 Any reference to the array must be dropped before the last reference to the
2656 related dataset is also dropped.
2657 """
2658 import gdalnumeric
2659 if options is None:
2660 virtualmem = self.GetVirtualMemAuto(eAccess)
2661 else:
2662 virtualmem = self.GetVirtualMemAuto(eAccess,options)
2663 return gdalnumeric.VirtualMemGetArray( virtualmem )
2664
2665 - def GetTiledVirtualMemArray(self, eAccess = gdalconst.GF_Read, xoff=0, yoff=0,
2666 xsize=None, ysize=None, tilexsize=256, tileysize=256,
2667 datatype = None,
2668 cache_size = 10 * 1024 * 1024, options = None):
2669 """Return a NumPy array for the band, seen as a virtual memory mapping with
2670 a tile organization.
2671 An element is accessed with array[tiley][tilex][y][x].
2672 Any reference to the array must be dropped before the last reference to the
2673 related dataset is also dropped.
2674 """
2675 import gdalnumeric
2676 if xsize is None:
2677 xsize = self.XSize
2678 if ysize is None:
2679 ysize = self.YSize
2680 if datatype is None:
2681 datatype = self.DataType
2682 if options is None:
2683 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,cache_size)
2684 else:
2685 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,cache_size,options)
2686 return gdalnumeric.VirtualMemGetArray( virtualmem )
2687
2690
2691
2692 Band_swigregister = _gdal.Band_swigregister
2693 Band_swigregister(Band)
2694
2696 """Proxy of C++ GDALColorTableShadow class."""
2697
2698 __swig_setmethods__ = {}
2699 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorTable, name, value)
2700 __swig_getmethods__ = {}
2701 __getattr__ = lambda self, name: _swig_getattr(self, ColorTable, name)
2702 __repr__ = _swig_repr
2703
2705 """__init__(GDALColorTableShadow self, GDALPaletteInterp palette) -> ColorTable"""
2706 this = _gdal.new_ColorTable(*args, **kwargs)
2707 try:
2708 self.this.append(this)
2709 except Exception:
2710 self.this = this
2711 __swig_destroy__ = _gdal.delete_ColorTable
2712 __del__ = lambda self: None
2713
2714 - def Clone(self, *args):
2715 """Clone(ColorTable self) -> ColorTable"""
2716 return _gdal.ColorTable_Clone(self, *args)
2717
2718
2720 """GetPaletteInterpretation(ColorTable self) -> GDALPaletteInterp"""
2721 return _gdal.ColorTable_GetPaletteInterpretation(self, *args)
2722
2723
2725 """GetCount(ColorTable self) -> int"""
2726 return _gdal.ColorTable_GetCount(self, *args)
2727
2728
2729 - def GetColorEntry(self, *args):
2730 """GetColorEntry(ColorTable self, int entry) -> ColorEntry"""
2731 return _gdal.ColorTable_GetColorEntry(self, *args)
2732
2733
2734 - def GetColorEntryAsRGB(self, *args):
2735 """GetColorEntryAsRGB(ColorTable self, int entry, ColorEntry centry) -> int"""
2736 return _gdal.ColorTable_GetColorEntryAsRGB(self, *args)
2737
2738
2739 - def SetColorEntry(self, *args):
2740 """SetColorEntry(ColorTable self, int entry, ColorEntry centry)"""
2741 return _gdal.ColorTable_SetColorEntry(self, *args)
2742
2743
2745 """CreateColorRamp(ColorTable self, int nStartIndex, ColorEntry startcolor, int nEndIndex, ColorEntry endcolor)"""
2746 return _gdal.ColorTable_CreateColorRamp(self, *args)
2747
2748 ColorTable_swigregister = _gdal.ColorTable_swigregister
2749 ColorTable_swigregister(ColorTable)
2750
2752 """Proxy of C++ GDALRasterAttributeTableShadow class."""
2753
2754 __swig_setmethods__ = {}
2755 __setattr__ = lambda self, name, value: _swig_setattr(self, RasterAttributeTable, name, value)
2756 __swig_getmethods__ = {}
2757 __getattr__ = lambda self, name: _swig_getattr(self, RasterAttributeTable, name)
2758 __repr__ = _swig_repr
2759
2761 """__init__(GDALRasterAttributeTableShadow self) -> RasterAttributeTable"""
2762 this = _gdal.new_RasterAttributeTable(*args)
2763 try:
2764 self.this.append(this)
2765 except Exception:
2766 self.this = this
2767 __swig_destroy__ = _gdal.delete_RasterAttributeTable
2768 __del__ = lambda self: None
2769
2770 - def Clone(self, *args):
2771 """Clone(RasterAttributeTable self) -> RasterAttributeTable"""
2772 return _gdal.RasterAttributeTable_Clone(self, *args)
2773
2774
2776 """GetColumnCount(RasterAttributeTable self) -> int"""
2777 return _gdal.RasterAttributeTable_GetColumnCount(self, *args)
2778
2779
2781 """GetNameOfCol(RasterAttributeTable self, int iCol) -> char const *"""
2782 return _gdal.RasterAttributeTable_GetNameOfCol(self, *args)
2783
2784
2786 """GetUsageOfCol(RasterAttributeTable self, int iCol) -> GDALRATFieldUsage"""
2787 return _gdal.RasterAttributeTable_GetUsageOfCol(self, *args)
2788
2789
2791 """GetTypeOfCol(RasterAttributeTable self, int iCol) -> GDALRATFieldType"""
2792 return _gdal.RasterAttributeTable_GetTypeOfCol(self, *args)
2793
2794
2796 """GetColOfUsage(RasterAttributeTable self, GDALRATFieldUsage eUsage) -> int"""
2797 return _gdal.RasterAttributeTable_GetColOfUsage(self, *args)
2798
2799
2801 """GetRowCount(RasterAttributeTable self) -> int"""
2802 return _gdal.RasterAttributeTable_GetRowCount(self, *args)
2803
2804
2806 """GetValueAsString(RasterAttributeTable self, int iRow, int iCol) -> char const *"""
2807 return _gdal.RasterAttributeTable_GetValueAsString(self, *args)
2808
2809
2811 """GetValueAsInt(RasterAttributeTable self, int iRow, int iCol) -> int"""
2812 return _gdal.RasterAttributeTable_GetValueAsInt(self, *args)
2813
2814
2816 """GetValueAsDouble(RasterAttributeTable self, int iRow, int iCol) -> double"""
2817 return _gdal.RasterAttributeTable_GetValueAsDouble(self, *args)
2818
2819
2821 """SetValueAsString(RasterAttributeTable self, int iRow, int iCol, char const * pszValue)"""
2822 return _gdal.RasterAttributeTable_SetValueAsString(self, *args)
2823
2824
2826 """SetValueAsInt(RasterAttributeTable self, int iRow, int iCol, int nValue)"""
2827 return _gdal.RasterAttributeTable_SetValueAsInt(self, *args)
2828
2829
2831 """SetValueAsDouble(RasterAttributeTable self, int iRow, int iCol, double dfValue)"""
2832 return _gdal.RasterAttributeTable_SetValueAsDouble(self, *args)
2833
2834
2836 """SetRowCount(RasterAttributeTable self, int nCount)"""
2837 return _gdal.RasterAttributeTable_SetRowCount(self, *args)
2838
2839
2841 """CreateColumn(RasterAttributeTable self, char const * pszName, GDALRATFieldType eType, GDALRATFieldUsage eUsage) -> int"""
2842 return _gdal.RasterAttributeTable_CreateColumn(self, *args)
2843
2844
2846 """GetLinearBinning(RasterAttributeTable self) -> bool"""
2847 return _gdal.RasterAttributeTable_GetLinearBinning(self, *args)
2848
2849
2851 """SetLinearBinning(RasterAttributeTable self, double dfRow0Min, double dfBinSize) -> int"""
2852 return _gdal.RasterAttributeTable_SetLinearBinning(self, *args)
2853
2854
2856 """GetRowOfValue(RasterAttributeTable self, double dfValue) -> int"""
2857 return _gdal.RasterAttributeTable_GetRowOfValue(self, *args)
2858
2859
2861 """ChangesAreWrittenToFile(RasterAttributeTable self) -> int"""
2862 return _gdal.RasterAttributeTable_ChangesAreWrittenToFile(self, *args)
2863
2864
2866 """DumpReadable(RasterAttributeTable self)"""
2867 return _gdal.RasterAttributeTable_DumpReadable(self, *args)
2868
2869
2871 import gdalnumeric
2872
2873 return gdalnumeric.RATWriteArray(self, array, field, start)
2874
2876 import gdalnumeric
2877
2878 return gdalnumeric.RATReadArray(self, field, start, length)
2879
2880 RasterAttributeTable_swigregister = _gdal.RasterAttributeTable_swigregister
2881 RasterAttributeTable_swigregister(RasterAttributeTable)
2882
2883
2885 """TermProgress_nocb(double dfProgress, char const * pszMessage=None, void * pData=None) -> int"""
2886 return _gdal.TermProgress_nocb(*args, **kwargs)
2887
2888 _gdal.TermProgress_swigconstant(_gdal)
2889 TermProgress = _gdal.TermProgress
2890
2894
2896 """DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2897 return _gdal.DitherRGB2PCT(*args, **kwargs)
2898
2900 """ReprojectImage(Dataset src_ds, Dataset dst_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg, double WarpMemoryLimit=0.0, double maxerror=0.0, GDALProgressFunc callback=0, void * callback_data=None, char ** options=None) -> CPLErr"""
2901 return _gdal.ReprojectImage(*args, **kwargs)
2902
2904 """ComputeProximity(Band srcBand, Band proximityBand, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2905 return _gdal.ComputeProximity(*args, **kwargs)
2906
2908 """RasterizeLayer(Dataset dataset, int bands, Layer layer, void * pfnTransformer=None, void * pTransformArg=None, int burn_values=0, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2909 return _gdal.RasterizeLayer(*args, **kwargs)
2910
2912 """Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2913 return _gdal.Polygonize(*args, **kwargs)
2914
2916 """FPolygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2917 return _gdal.FPolygonize(*args, **kwargs)
2918
2920 """FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2921 return _gdal.FillNodata(*args, **kwargs)
2922
2924 """SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness=4, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2925 return _gdal.SieveFilter(*args, **kwargs)
2926
2928 """RegenerateOverviews(Band srcBand, int overviewBandCount, char const * resampling, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2929 return _gdal.RegenerateOverviews(*args, **kwargs)
2930
2932 """RegenerateOverview(Band srcBand, Band overviewBand, char const * resampling, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2933 return _gdal.RegenerateOverview(*args, **kwargs)
2934
2936 """ContourGenerate(Band srcBand, double contourInterval, double contourBase, int fixedLevelCount, int useNoData, double noDataValue, Layer dstLayer, int idField, int elevField, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2937 return _gdal.ContourGenerate(*args, **kwargs)
2938
2940 """AutoCreateWarpedVRT(Dataset src_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg, double maxerror=0.0) -> Dataset"""
2941 return _gdal.AutoCreateWarpedVRT(*args)
2942
2944 """CreatePansharpenedVRT(char const * pszXML, Band panchroBand, int nInputSpectralBands) -> Dataset"""
2945 return _gdal.CreatePansharpenedVRT(*args)
2976
2977 GDALTransformerInfoShadow_swigregister = _gdal.GDALTransformerInfoShadow_swigregister
2978 GDALTransformerInfoShadow_swigregister(GDALTransformerInfoShadow)
2979
2980
2984
2986 """ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) -> Dataset"""
2987 return _gdal.ApplyVerticalShiftGrid(*args, **kwargs)
2988
2992
2996
2998 """VersionInfo(char const * request) -> char const *"""
2999 return _gdal.VersionInfo(*args)
3000
3002 """AllRegister()"""
3003 return _gdal.AllRegister(*args)
3004
3008
3010 """GetCacheMax() -> GIntBig"""
3011 return _gdal.GetCacheMax(*args)
3012
3014 """GetCacheUsed() -> GIntBig"""
3015 return _gdal.GetCacheUsed(*args)
3016
3018 """SetCacheMax(GIntBig nBytes)"""
3019 return _gdal.SetCacheMax(*args)
3020
3022 """GetDataTypeSize(GDALDataType eDataType) -> int"""
3023 return _gdal.GetDataTypeSize(*args)
3024
3026 """DataTypeIsComplex(GDALDataType eDataType) -> int"""
3027 return _gdal.DataTypeIsComplex(*args)
3028
3030 """GetDataTypeName(GDALDataType eDataType) -> char const *"""
3031 return _gdal.GetDataTypeName(*args)
3032
3034 """GetDataTypeByName(char const * pszDataTypeName) -> GDALDataType"""
3035 return _gdal.GetDataTypeByName(*args)
3036
3038 """GetColorInterpretationName(GDALColorInterp eColorInterp) -> char const *"""
3039 return _gdal.GetColorInterpretationName(*args)
3040
3042 """GetPaletteInterpretationName(GDALPaletteInterp ePaletteInterp) -> char const *"""
3043 return _gdal.GetPaletteInterpretationName(*args)
3044
3046 """DecToDMS(double arg1, char const * arg2, int arg3=2) -> char const *"""
3047 return _gdal.DecToDMS(*args)
3048
3050 """PackedDMSToDec(double dfPacked) -> double"""
3051 return _gdal.PackedDMSToDec(*args)
3052
3054 """DecToPackedDMS(double dfDec) -> double"""
3055 return _gdal.DecToPackedDMS(*args)
3056
3058 """ParseXMLString(char * pszXMLString) -> CPLXMLNode *"""
3059 return _gdal.ParseXMLString(*args)
3060
3062 """SerializeXMLTree(CPLXMLNode * xmlnode) -> retStringAndCPLFree *"""
3063 return _gdal.SerializeXMLTree(*args)
3064
3066 """GetJPEG2000Structure(char const * pszFilename, char ** options=None) -> CPLXMLNode *"""
3067 return _gdal.GetJPEG2000Structure(*args)
3068
3070 """GetJPEG2000StructureAsString(char const * pszFilename, char ** options=None) -> retStringAndCPLFree *"""
3071 return _gdal.GetJPEG2000StructureAsString(*args)
3072
3074 """GetDriverCount() -> int"""
3075 return _gdal.GetDriverCount(*args)
3076
3078 """GetDriverByName(char const * name) -> Driver"""
3079 return _gdal.GetDriverByName(*args)
3080
3082 """GetDriver(int i) -> Driver"""
3083 return _gdal.GetDriver(*args)
3084
3086 """Open(char const * utf8_path, GDALAccess eAccess) -> Dataset"""
3087 return _gdal.Open(*args)
3088
3090 """OpenEx(char const * utf8_path, unsigned int nOpenFlags=0, char ** allowed_drivers=None, char ** open_options=None, char ** sibling_files=None) -> Dataset"""
3091 return _gdal.OpenEx(*args, **kwargs)
3092
3094 """OpenShared(char const * utf8_path, GDALAccess eAccess) -> Dataset"""
3095 return _gdal.OpenShared(*args)
3096
3098 """IdentifyDriver(char const * utf8_path, char ** papszSiblings=None) -> Driver"""
3099 return _gdal.IdentifyDriver(*args)
3100
3102 """IdentifyDriverEx(char const * utf8_path, unsigned int nIdentifyFlags=0, char ** allowed_drivers=None, char ** sibling_files=None) -> Driver"""
3103 return _gdal.IdentifyDriverEx(*args, **kwargs)
3104
3106 """GeneralCmdLineProcessor(char ** papszArgv, int nOptions=0) -> char **"""
3107 return _gdal.GeneralCmdLineProcessor(*args)
3108
3109 __version__ = _gdal.VersionInfo("RELEASE_NAME")
3110
3129 GDALInfoOptions_swigregister = _gdal.GDALInfoOptions_swigregister
3130 GDALInfoOptions_swigregister(GDALInfoOptions)
3131
3132
3134 """InfoInternal(Dataset hDataset, GDALInfoOptions infoOptions) -> retStringAndCPLFree *"""
3135 return _gdal.InfoInternal(*args)
3154 GDALTranslateOptions_swigregister = _gdal.GDALTranslateOptions_swigregister
3155 GDALTranslateOptions_swigregister(GDALTranslateOptions)
3156
3157
3159 """TranslateInternal(char const * dest, Dataset dataset, GDALTranslateOptions translateOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3160 return _gdal.TranslateInternal(*args)
3179 GDALWarpAppOptions_swigregister = _gdal.GDALWarpAppOptions_swigregister
3180 GDALWarpAppOptions_swigregister(GDALWarpAppOptions)
3181
3182
3184 """wrapper_GDALWarpDestDS(Dataset dstDS, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
3185 return _gdal.wrapper_GDALWarpDestDS(*args)
3186
3188 """wrapper_GDALWarpDestName(char const * dest, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3189 return _gdal.wrapper_GDALWarpDestName(*args)
3208 GDALVectorTranslateOptions_swigregister = _gdal.GDALVectorTranslateOptions_swigregister
3209 GDALVectorTranslateOptions_swigregister(GDALVectorTranslateOptions)
3210
3211
3213 """wrapper_GDALVectorTranslateDestDS(Dataset dstDS, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
3214 return _gdal.wrapper_GDALVectorTranslateDestDS(*args)
3215
3217 """wrapper_GDALVectorTranslateDestName(char const * dest, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3218 return _gdal.wrapper_GDALVectorTranslateDestName(*args)
3237 GDALDEMProcessingOptions_swigregister = _gdal.GDALDEMProcessingOptions_swigregister
3238 GDALDEMProcessingOptions_swigregister(GDALDEMProcessingOptions)
3239
3240
3242 """DEMProcessingInternal(char const * dest, Dataset dataset, char const * pszProcessing, char const * pszColorFilename, GDALDEMProcessingOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3243 return _gdal.DEMProcessingInternal(*args)
3262 GDALNearblackOptions_swigregister = _gdal.GDALNearblackOptions_swigregister
3263 GDALNearblackOptions_swigregister(GDALNearblackOptions)
3264
3265
3267 """wrapper_GDALNearblackDestDS(Dataset dstDS, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
3268 return _gdal.wrapper_GDALNearblackDestDS(*args)
3269
3271 """wrapper_GDALNearblackDestName(char const * dest, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3272 return _gdal.wrapper_GDALNearblackDestName(*args)
3291 GDALGridOptions_swigregister = _gdal.GDALGridOptions_swigregister
3292 GDALGridOptions_swigregister(GDALGridOptions)
3293
3294
3296 """GridInternal(char const * dest, Dataset dataset, GDALGridOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3297 return _gdal.GridInternal(*args)
3316 GDALRasterizeOptions_swigregister = _gdal.GDALRasterizeOptions_swigregister
3317 GDALRasterizeOptions_swigregister(GDALRasterizeOptions)
3318
3319
3321 """wrapper_GDALRasterizeDestDS(Dataset dstDS, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
3322 return _gdal.wrapper_GDALRasterizeDestDS(*args)
3323
3325 """wrapper_GDALRasterizeDestName(char const * dest, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3326 return _gdal.wrapper_GDALRasterizeDestName(*args)
3345 GDALBuildVRTOptions_swigregister = _gdal.GDALBuildVRTOptions_swigregister
3346 GDALBuildVRTOptions_swigregister(GDALBuildVRTOptions)
3347
3348
3350 """BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3351 return _gdal.BuildVRTInternalObjects(*args)
3352
3354 """BuildVRTInternalNames(char const * dest, char ** source_filenames, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
3355 return _gdal.BuildVRTInternalNames(*args)
3356
3357