1
2
3
4
5
6
7 from sys import version_info as _swig_python_version_info
8 if _swig_python_version_info >= (2, 7, 0):
10 import importlib
11 pkg = __name__.rpartition('.')[0]
12 mname = '.'.join((pkg, '_gdal')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_gdal')
17 _gdal = swig_import_helper()
18 del swig_import_helper
19 elif _swig_python_version_info >= (2, 6, 0):
21 from os.path import dirname
22 import imp
23 fp = None
24 try:
25 fp, pathname, description = imp.find_module('_gdal', [dirname(__file__)])
26 except ImportError:
27 import _gdal
28 return _gdal
29 try:
30 _mod = imp.load_module('_gdal', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _gdal = swig_import_helper()
36 del swig_import_helper
37 else:
38 import _gdal
39 del _swig_python_version_info
40
41 try:
42 _swig_property = property
43 except NameError:
44 pass
45
46 try:
47 import builtins as __builtin__
48 except ImportError:
49 import __builtin__
50
52 if (name == "thisown"):
53 return self.this.own(value)
54 if (name == "this"):
55 if type(value).__name__ == 'SwigPyObject':
56 self.__dict__[name] = value
57 return
58 method = class_type.__swig_setmethods__.get(name, None)
59 if method:
60 return method(self, value)
61 if (not static):
62 if _newclass:
63 object.__setattr__(self, name, value)
64 else:
65 self.__dict__[name] = value
66 else:
67 raise AttributeError("You cannot add attributes to %s" % self)
68
69
72
73
75 if (name == "thisown"):
76 return self.this.own()
77 method = class_type.__swig_getmethods__.get(name, None)
78 if method:
79 return method(self)
80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
81
82
84 try:
85 strthis = "proxy of " + self.this.__repr__()
86 except __builtin__.Exception:
87 strthis = ""
88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
89
90 try:
91 _object = object
92 _newclass = 1
93 except __builtin__.Exception:
96 _newclass = 0
97
98
99
100
101 have_warned = 0
103 global have_warned
104
105 if have_warned == 1:
106 return
107
108 have_warned = 1
109 if sub_package is None or sub_package == 'utils':
110 sub_package = 'osgeo_utils'
111 if new_module is None:
112 new_module = module
113 new_module = '{}.{}'.format(sub_package, new_module)
114
115 from warnings import warn
116 warn('{}.py was placed in a namespace, it is now available as {}' .format(module, new_module),
117 DeprecationWarning)
118
119
120 from osgeo.gdalconst import *
121 from osgeo import gdalconst
122
123
124 import sys
125 byteorders = {"little": "<",
126 "big": ">"}
127 array_modes = { gdalconst.GDT_Int16: ("%si2" % byteorders[sys.byteorder]),
128 gdalconst.GDT_UInt16: ("%su2" % byteorders[sys.byteorder]),
129 gdalconst.GDT_Int32: ("%si4" % byteorders[sys.byteorder]),
130 gdalconst.GDT_UInt32: ("%su4" % byteorders[sys.byteorder]),
131 gdalconst.GDT_Float32: ("%sf4" % byteorders[sys.byteorder]),
132 gdalconst.GDT_Float64: ("%sf8" % byteorders[sys.byteorder]),
133 gdalconst.GDT_CFloat32: ("%sf4" % byteorders[sys.byteorder]),
134 gdalconst.GDT_CFloat64: ("%sf8" % byteorders[sys.byteorder]),
135 gdalconst.GDT_Byte: ("%st8" % byteorders[sys.byteorder]),
136 }
137
139 src_ds = Open(src_filename)
140 if src_ds is None or src_ds == 'NULL':
141 return 1
142
143 ct = ColorTable()
144 err = ComputeMedianCutPCT(src_ds.GetRasterBand(1),
145 src_ds.GetRasterBand(2),
146 src_ds.GetRasterBand(3),
147 256, ct)
148 if err != 0:
149 return err
150
151 gtiff_driver = GetDriverByName('GTiff')
152 if gtiff_driver is None:
153 return 1
154
155 dst_ds = gtiff_driver.Create(dst_filename,
156 src_ds.RasterXSize, src_ds.RasterYSize)
157 dst_ds.GetRasterBand(1).SetRasterColorTable(ct)
158
159 err = DitherRGB2PCT(src_ds.GetRasterBand(1),
160 src_ds.GetRasterBand(2),
161 src_ds.GetRasterBand(3),
162 dst_ds.GetRasterBand(1),
163 ct)
164 dst_ds = None
165 src_ds = None
166
167 return 0
168
169 -def listdir(path, recursionLevel = -1, options = []):
170 """ Iterate over a directory.
171
172 recursionLevel = -1 means unlimited level of recursion.
173 """
174 dir = OpenDir(path, recursionLevel, options)
175 if not dir:
176 raise OSError(path + ' does not exist')
177 try:
178 while True:
179 entry = GetNextDirEntry(dir)
180 if not entry:
181 break
182 yield entry
183 finally:
184 CloseDir(dir)
185
186
190
194
198
200 """VSIFReadL(unsigned int nMembSize, unsigned int nMembCount, VSILFILE fp) -> unsigned int"""
201 return _gdal.VSIFReadL(*args)
202
206
207
208 -def InfoOptions(options=None, format='text', deserialize=True,
209 computeMinMax=False, reportHistograms=False, reportProj4=False,
210 stats=False, approxStats=False, computeChecksum=False,
211 showGCPs=True, showMetadata=True, showRAT=True, showColorTable=True,
212 listMDD=False, showFileList=True, allMetadata=False,
213 extraMDDomains=None, wktFormat=None):
214 """ Create a InfoOptions() object that can be passed to gdal.Info()
215 options can be be an array of strings, a string or let empty and filled from other keywords."""
216
217 options = [] if options is None else options
218
219 if isinstance(options, str):
220 new_options = ParseCommandLine(options)
221 format = 'text'
222 if '-json' in new_options:
223 format = 'json'
224 else:
225 new_options = options
226 if format == 'json':
227 new_options += ['-json']
228 if '-json' in new_options:
229 format = 'json'
230 if computeMinMax:
231 new_options += ['-mm']
232 if reportHistograms:
233 new_options += ['-hist']
234 if reportProj4:
235 new_options += ['-proj4']
236 if stats:
237 new_options += ['-stats']
238 if approxStats:
239 new_options += ['-approx_stats']
240 if computeChecksum:
241 new_options += ['-checksum']
242 if not showGCPs:
243 new_options += ['-nogcp']
244 if not showMetadata:
245 new_options += ['-nomd']
246 if not showRAT:
247 new_options += ['-norat']
248 if not showColorTable:
249 new_options += ['-noct']
250 if listMDD:
251 new_options += ['-listmdd']
252 if not showFileList:
253 new_options += ['-nofl']
254 if allMetadata:
255 new_options += ['-mdd', 'all']
256 if wktFormat:
257 new_options += ['-wkt_format', wktFormat]
258 if extraMDDomains is not None:
259 for mdd in extraMDDomains:
260 new_options += ['-mdd', mdd]
261
262 return (GDALInfoOptions(new_options), format, deserialize)
263
264 -def Info(ds, **kwargs):
265 """ Return information on a dataset.
266 Arguments are :
267 ds --- a Dataset object or a filename
268 Keyword arguments are :
269 options --- return of gdal.InfoOptions(), string or array of strings
270 other keywords arguments of gdal.InfoOptions()
271 If options is provided as a gdal.InfoOptions() object, other keywords are ignored. """
272 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
273 (opts, format, deserialize) = InfoOptions(**kwargs)
274 else:
275 (opts, format, deserialize) = kwargs['options']
276 if isinstance(ds, str):
277 ds = Open(ds)
278 ret = InfoInternal(ds, opts)
279 if format == 'json' and deserialize:
280 import json
281 ret = json.loads(ret)
282 return ret
283
284
285 -def MultiDimInfoOptions(options=None, detailed=False, array=None, arrayoptions=None, limit=None, as_text=False):
286 """ Create a MultiDimInfoOptions() object that can be passed to gdal.MultiDimInfo()
287 options can be be an array of strings, a string or let empty and filled from other keywords."""
288
289 options = [] if options is None else options
290
291 if isinstance(options, str):
292 new_options = ParseCommandLine(options)
293 else:
294 new_options = options
295 if detailed:
296 new_options += ['-detailed']
297 if array:
298 new_options += ['-array', array]
299 if limit:
300 new_options += ['-limit', str(limit)]
301 if arrayoptions:
302 for option in arrayoptions:
303 new_options += ['-arrayoption', option]
304
305 return GDALMultiDimInfoOptions(new_options), as_text
306
308 """ Return information on a dataset.
309 Arguments are :
310 ds --- a Dataset object or a filename
311 Keyword arguments are :
312 options --- return of gdal.MultiDimInfoOptions(), string or array of strings
313 other keywords arguments of gdal.MultiDimInfoOptions()
314 If options is provided as a gdal.MultiDimInfoOptions() object, other keywords are ignored. """
315 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
316 opts, as_text = MultiDimInfoOptions(**kwargs)
317 else:
318 opts = kwargs['options']
319 as_text = True
320 if isinstance(ds, str):
321 ds = OpenEx(ds, OF_VERBOSE_ERROR | OF_MULTIDIM_RASTER)
322 ret = MultiDimInfoInternal(ds, opts)
323 if not as_text:
324 import json
325 ret = json.loads(ret)
326 return ret
327
328
330 return x if isinstance(x, str) else '%.18g' % x
331
332 mapGRIORAMethodToString = {
333 gdalconst.GRIORA_NearestNeighbour: 'near',
334 gdalconst.GRIORA_Bilinear: 'bilinear',
335 gdalconst.GRIORA_Cubic: 'cubic',
336 gdalconst.GRIORA_CubicSpline: 'cubicspline',
337 gdalconst.GRIORA_Lanczos: 'lanczos',
338 gdalconst.GRIORA_Average: 'average',
339 gdalconst.GRIORA_RMS: 'rms',
340 gdalconst.GRIORA_Mode: 'mode',
341 gdalconst.GRIORA_Gauss: 'gauss',
342 }
343
344 -def TranslateOptions(options=None, format=None,
345 outputType = gdalconst.GDT_Unknown, bandList=None, maskBand=None,
346 width = 0, height = 0, widthPct = 0.0, heightPct = 0.0,
347 xRes = 0.0, yRes = 0.0,
348 creationOptions=None, srcWin=None, projWin=None, projWinSRS=None, strict = False,
349 unscale = False, scaleParams=None, exponents=None,
350 outputBounds=None, metadataOptions=None,
351 outputSRS=None, nogcp=False, GCPs=None,
352 noData=None, rgbExpand=None,
353 stats = False, rat = True, resampleAlg=None,
354 callback=None, callback_data=None):
355 """ Create a TranslateOptions() object that can be passed to gdal.Translate()
356 Keyword arguments are :
357 options --- can be be an array of strings, a string or let empty and filled from other keywords.
358 format --- output format ("GTiff", etc...)
359 outputType --- output type (gdalconst.GDT_Byte, etc...)
360 bandList --- array of band numbers (index start at 1)
361 maskBand --- mask band to generate or not ("none", "auto", "mask", 1, ...)
362 width --- width of the output raster in pixel
363 height --- height of the output raster in pixel
364 widthPct --- width of the output raster in percentage (100 = original width)
365 heightPct --- height of the output raster in percentage (100 = original height)
366 xRes --- output horizontal resolution
367 yRes --- output vertical resolution
368 creationOptions --- list of creation options
369 srcWin --- subwindow in pixels to extract: [left_x, top_y, width, height]
370 projWin --- subwindow in projected coordinates to extract: [ulx, uly, lrx, lry]
371 projWinSRS --- SRS in which projWin is expressed
372 strict --- strict mode
373 unscale --- unscale values with scale and offset metadata
374 scaleParams --- list of scale parameters, each of the form [src_min,src_max] or [src_min,src_max,dst_min,dst_max]
375 exponents --- list of exponentiation parameters
376 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry]
377 metadataOptions --- list of metadata options
378 outputSRS --- assigned output SRS
379 nogcp --- ignore GCP in the raster
380 GCPs --- list of GCPs
381 noData --- nodata value (or "none" to unset it)
382 rgbExpand --- Color palette expansion mode: "gray", "rgb", "rgba"
383 stats --- whether to calculate statistics
384 rat --- whether to write source RAT
385 resampleAlg --- resampling mode
386 callback --- callback method
387 callback_data --- user data for callback
388 """
389
390
391 return_option_list = options == '__RETURN_OPTION_LIST__'
392 if return_option_list:
393 options = []
394 else:
395 options = [] if options is None else options
396
397 if isinstance(options, str):
398 new_options = ParseCommandLine(options)
399 else:
400 new_options = options
401 if format is not None:
402 new_options += ['-of', format]
403 if outputType != gdalconst.GDT_Unknown:
404 new_options += ['-ot', GetDataTypeName(outputType)]
405 if maskBand != None:
406 new_options += ['-mask', str(maskBand)]
407 if bandList != None:
408 for b in bandList:
409 new_options += ['-b', str(b)]
410 if width != 0 or height != 0:
411 new_options += ['-outsize', str(width), str(height)]
412 elif widthPct != 0 and heightPct != 0:
413 new_options += ['-outsize', str(widthPct) + '%%', str(heightPct) + '%%']
414 if creationOptions is not None:
415 if isinstance(creationOptions, str):
416 new_options += ['-co', creationOptions]
417 else:
418 for opt in creationOptions:
419 new_options += ['-co', opt]
420 if srcWin is not None:
421 new_options += ['-srcwin', _strHighPrec(srcWin[0]), _strHighPrec(srcWin[1]), _strHighPrec(srcWin[2]), _strHighPrec(srcWin[3])]
422 if strict:
423 new_options += ['-strict']
424 if unscale:
425 new_options += ['-unscale']
426 if scaleParams:
427 for scaleParam in scaleParams:
428 new_options += ['-scale']
429 for v in scaleParam:
430 new_options += [str(v)]
431 if exponents:
432 for exponent in exponents:
433 new_options += ['-exponent', _strHighPrec(exponent)]
434 if outputBounds is not None:
435 new_options += ['-a_ullr', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
436 if metadataOptions is not None:
437 if isinstance(metadataOptions, str):
438 new_options += ['-mo', metadataOptions]
439 else:
440 for opt in metadataOptions:
441 new_options += ['-mo', opt]
442 if outputSRS is not None:
443 new_options += ['-a_srs', str(outputSRS)]
444 if nogcp:
445 new_options += ['-nogcp']
446 if GCPs is not None:
447 for gcp in GCPs:
448 new_options += ['-gcp', _strHighPrec(gcp.GCPPixel), _strHighPrec(gcp.GCPLine), _strHighPrec(gcp.GCPX), str(gcp.GCPY), _strHighPrec(gcp.GCPZ)]
449 if projWin is not None:
450 new_options += ['-projwin', _strHighPrec(projWin[0]), _strHighPrec(projWin[1]), _strHighPrec(projWin[2]), _strHighPrec(projWin[3])]
451 if projWinSRS is not None:
452 new_options += ['-projwin_srs', str(projWinSRS)]
453 if noData is not None:
454 new_options += ['-a_nodata', _strHighPrec(noData)]
455 if rgbExpand is not None:
456 new_options += ['-expand', str(rgbExpand)]
457 if stats:
458 new_options += ['-stats']
459 if not rat:
460 new_options += ['-norat']
461 if resampleAlg is not None:
462 if resampleAlg in mapGRIORAMethodToString:
463 new_options += ['-r', mapGRIORAMethodToString[resampleAlg]]
464 else:
465 new_options += ['-r', str(resampleAlg)]
466 if xRes != 0 and yRes != 0:
467 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)]
468
469 if return_option_list:
470 return new_options
471
472 return (GDALTranslateOptions(new_options), callback, callback_data)
473
475 """ Convert a dataset.
476 Arguments are :
477 destName --- Output dataset name
478 srcDS --- a Dataset object or a filename
479 Keyword arguments are :
480 options --- return of gdal.TranslateOptions(), string or array of strings
481 other keywords arguments of gdal.TranslateOptions()
482 If options is provided as a gdal.TranslateOptions() object, other keywords are ignored. """
483
484 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
485 (opts, callback, callback_data) = TranslateOptions(**kwargs)
486 else:
487 (opts, callback, callback_data) = kwargs['options']
488 if isinstance(srcDS, str):
489 srcDS = Open(srcDS)
490
491 return TranslateInternal(destName, srcDS, opts, callback, callback_data)
492
493 -def WarpOptions(options=None, format=None,
494 outputBounds=None,
495 outputBoundsSRS=None,
496 xRes=None, yRes=None, targetAlignedPixels = False,
497 width = 0, height = 0,
498 srcSRS=None, dstSRS=None,
499 coordinateOperation=None,
500 srcAlpha = False, dstAlpha = False,
501 warpOptions=None, errorThreshold=None,
502 warpMemoryLimit=None, creationOptions=None, outputType = gdalconst.GDT_Unknown,
503 workingType = gdalconst.GDT_Unknown, resampleAlg=None,
504 srcNodata=None, dstNodata=None, multithread = False,
505 tps = False, rpc = False, geoloc = False, polynomialOrder=None,
506 transformerOptions=None, cutlineDSName=None,
507 cutlineLayer=None, cutlineWhere=None, cutlineSQL=None, cutlineBlend=None, cropToCutline = False,
508 copyMetadata = True, metadataConflictValue=None,
509 setColorInterpretation = False,
510 overviewLevel = 'AUTO',
511 callback=None, callback_data=None):
512 """ Create a WarpOptions() object that can be passed to gdal.Warp()
513 Keyword arguments are :
514 options --- can be be an array of strings, a string or let empty and filled from other keywords.
515 format --- output format ("GTiff", etc...)
516 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS
517 outputBoundsSRS --- SRS in which output bounds are expressed, in the case they are not expressed in dstSRS
518 xRes, yRes --- output resolution in target SRS
519 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution
520 width --- width of the output raster in pixel
521 height --- height of the output raster in pixel
522 srcSRS --- source SRS
523 dstSRS --- output SRS
524 coordinateOperation -- coordinate operation as a PROJ string or WKT string
525 srcAlpha --- whether to force the last band of the input dataset to be considered as an alpha band
526 dstAlpha --- whether to force the creation of an output alpha band
527 outputType --- output type (gdalconst.GDT_Byte, etc...)
528 workingType --- working type (gdalconst.GDT_Byte, etc...)
529 warpOptions --- list of warping options
530 errorThreshold --- error threshold for approximation transformer (in pixels)
531 warpMemoryLimit --- size of working buffer in MB
532 resampleAlg --- resampling mode
533 creationOptions --- list of creation options
534 srcNodata --- source nodata value(s)
535 dstNodata --- output nodata value(s)
536 multithread --- whether to multithread computation and I/O operations
537 tps --- whether to use Thin Plate Spline GCP transformer
538 rpc --- whether to use RPC transformer
539 geoloc --- whether to use GeoLocation array transformer
540 polynomialOrder --- order of polynomial GCP interpolation
541 transformerOptions --- list of transformer options
542 cutlineDSName --- cutline dataset name
543 cutlineLayer --- cutline layer name
544 cutlineWhere --- cutline WHERE clause
545 cutlineSQL --- cutline SQL statement
546 cutlineBlend --- cutline blend distance in pixels
547 cropToCutline --- whether to use cutline extent for output bounds
548 copyMetadata --- whether to copy source metadata
549 metadataConflictValue --- metadata data conflict value
550 setColorInterpretation --- whether to force color interpretation of input bands to output bands
551 overviewLevel --- To specify which overview level of source files must be used
552 callback --- callback method
553 callback_data --- user data for callback
554 """
555
556
557 return_option_list = options == '__RETURN_OPTION_LIST__'
558 if return_option_list:
559 options = []
560 else:
561 options = [] if options is None else options
562
563 if isinstance(options, str):
564 new_options = ParseCommandLine(options)
565 else:
566 new_options = options
567 if format is not None:
568 new_options += ['-of', format]
569 if outputType != gdalconst.GDT_Unknown:
570 new_options += ['-ot', GetDataTypeName(outputType)]
571 if workingType != gdalconst.GDT_Unknown:
572 new_options += ['-wt', GetDataTypeName(workingType)]
573 if outputBounds is not None:
574 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
575 if outputBoundsSRS is not None:
576 new_options += ['-te_srs', str(outputBoundsSRS)]
577 if xRes is not None and yRes is not None:
578 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)]
579 if width != 0 or height != 0:
580 new_options += ['-ts', str(width), str(height)]
581 if srcSRS is not None:
582 new_options += ['-s_srs', str(srcSRS)]
583 if dstSRS is not None:
584 new_options += ['-t_srs', str(dstSRS)]
585 if coordinateOperation is not None:
586 new_options += ['-ct', coordinateOperation]
587 if targetAlignedPixels:
588 new_options += ['-tap']
589 if srcAlpha:
590 new_options += ['-srcalpha']
591 if dstAlpha:
592 new_options += ['-dstalpha']
593 if warpOptions is not None:
594 for opt in warpOptions:
595 new_options += ['-wo', str(opt)]
596 if errorThreshold is not None:
597 new_options += ['-et', _strHighPrec(errorThreshold)]
598 if resampleAlg is not None:
599
600 mapMethodToString = {
601 gdalconst.GRA_NearestNeighbour: 'near',
602 gdalconst.GRA_Bilinear: 'bilinear',
603 gdalconst.GRA_Cubic: 'cubic',
604 gdalconst.GRA_CubicSpline: 'cubicspline',
605 gdalconst.GRA_Lanczos: 'lanczos',
606 gdalconst.GRA_Average: 'average',
607 gdalconst.GRA_RMS: 'rms',
608 gdalconst.GRA_Mode: 'mode',
609 gdalconst.GRA_Max: 'max',
610 gdalconst.GRA_Min: 'min',
611 gdalconst.GRA_Med: 'med',
612 gdalconst.GRA_Q1: 'q1',
613 gdalconst.GRA_Q3: 'q3',
614 gdalconst.GRA_Sum: 'sum',
615 }
616
617 if resampleAlg in mapMethodToString:
618 new_options += ['-r', mapMethodToString[resampleAlg]]
619 else:
620 new_options += ['-r', str(resampleAlg)]
621 if warpMemoryLimit is not None:
622 new_options += ['-wm', str(warpMemoryLimit)]
623 if creationOptions is not None:
624 for opt in creationOptions:
625 new_options += ['-co', opt]
626 if srcNodata is not None:
627 new_options += ['-srcnodata', str(srcNodata)]
628 if dstNodata is not None:
629 new_options += ['-dstnodata', str(dstNodata)]
630 if multithread:
631 new_options += ['-multi']
632 if tps:
633 new_options += ['-tps']
634 if rpc:
635 new_options += ['-rpc']
636 if geoloc:
637 new_options += ['-geoloc']
638 if polynomialOrder is not None:
639 new_options += ['-order', str(polynomialOrder)]
640 if transformerOptions is not None:
641 for opt in transformerOptions:
642 new_options += ['-to', opt]
643 if cutlineDSName is not None:
644 new_options += ['-cutline', str(cutlineDSName)]
645 if cutlineLayer is not None:
646 new_options += ['-cl', str(cutlineLayer)]
647 if cutlineWhere is not None:
648 new_options += ['-cwhere', str(cutlineWhere)]
649 if cutlineSQL is not None:
650 new_options += ['-csql', str(cutlineSQL)]
651 if cutlineBlend is not None:
652 new_options += ['-cblend', str(cutlineBlend)]
653 if cropToCutline:
654 new_options += ['-crop_to_cutline']
655 if not copyMetadata:
656 new_options += ['-nomd']
657 if metadataConflictValue:
658 new_options += ['-cvmd', str(metadataConflictValue)]
659 if setColorInterpretation:
660 new_options += ['-setci']
661
662 if overviewLevel is None or isinstance(overviewLevel, str):
663 pass
664 elif isinstance(overviewLevel, int):
665 if overviewLevel < 0:
666 overviewLevel = 'AUTO' + str(overviewLevel)
667 else:
668 overviewLevel = str(overviewLevel)
669 else:
670 overviewLevel = None
671
672 if overviewLevel is not None and overviewLevel != 'AUTO':
673 new_options += ['-ovr', overviewLevel]
674
675 if return_option_list:
676 return new_options
677
678 return (GDALWarpAppOptions(new_options), callback, callback_data)
679
680 -def Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs):
681 """ Warp one or several datasets.
682 Arguments are :
683 destNameOrDestDS --- Output dataset name or object
684 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename
685 Keyword arguments are :
686 options --- return of gdal.WarpOptions(), string or array of strings
687 other keywords arguments of gdal.WarpOptions()
688 If options is provided as a gdal.WarpOptions() object, other keywords are ignored. """
689
690 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
691 (opts, callback, callback_data) = WarpOptions(**kwargs)
692 else:
693 (opts, callback, callback_data) = kwargs['options']
694 if isinstance(srcDSOrSrcDSTab, str):
695 srcDSTab = [Open(srcDSOrSrcDSTab)]
696 elif isinstance(srcDSOrSrcDSTab, list):
697 srcDSTab = []
698 for elt in srcDSOrSrcDSTab:
699 if isinstance(elt, str):
700 srcDSTab.append(Open(elt))
701 else:
702 srcDSTab.append(elt)
703 else:
704 srcDSTab = [srcDSOrSrcDSTab]
705
706 if isinstance(destNameOrDestDS, str):
707 return wrapper_GDALWarpDestName(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
708 else:
709 return wrapper_GDALWarpDestDS(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
710
711
712 -def VectorTranslateOptions(options=None, format=None,
713 accessMode=None,
714 srcSRS=None, dstSRS=None, reproject=True,
715 coordinateOperation=None,
716 SQLStatement=None, SQLDialect=None, where=None, selectFields=None,
717 addFields=False,
718 forceNullable=False,
719 emptyStrAsNull=False,
720 spatFilter=None, spatSRS=None,
721 datasetCreationOptions=None,
722 layerCreationOptions=None,
723 layers=None,
724 layerName=None,
725 geometryType=None,
726 dim=None,
727 segmentizeMaxDist= None,
728 makeValid=False,
729 zField=None,
730 resolveDomains=False,
731 skipFailures=False,
732 limit=None,
733 callback=None, callback_data=None):
734 """ Create a VectorTranslateOptions() object that can be passed to gdal.VectorTranslate()
735 Keyword arguments are :
736 options --- can be be an array of strings, a string or let empty and filled from other keywords.
737 format --- output format ("ESRI Shapefile", etc...)
738 accessMode --- None for creation, 'update', 'append', 'overwrite'
739 srcSRS --- source SRS
740 dstSRS --- output SRS (with reprojection if reproject = True)
741 coordinateOperation -- coordinate operation as a PROJ string or WKT string
742 reproject --- whether to do reprojection
743 SQLStatement --- SQL statement to apply to the source dataset
744 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...)
745 where --- WHERE clause to apply to source layer(s)
746 selectFields --- list of fields to select
747 addFields --- whether to add new fields found in source layers (to be used with accessMode == 'append')
748 forceNullable --- whether to drop NOT NULL constraints on newly created fields
749 emptyStrAsNull --- whether to treat empty string values as NULL
750 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box
751 spatSRS --- SRS in which the spatFilter is expressed. If not specified, it is assumed to be the one of the layer(s)
752 datasetCreationOptions --- list of dataset creation options
753 layerCreationOptions --- list of layer creation options
754 layers --- list of layers to convert
755 layerName --- output layer name
756 geometryType --- output layer geometry type ('POINT', ....)
757 dim --- output dimension ('XY', 'XYZ', 'XYM', 'XYZM', 'layer_dim')
758 segmentizeMaxDist --- maximum distance between consecutive nodes of a line geometry
759 makeValid --- run MakeValid() on geometries
760 zField --- name of field to use to set the Z component of geometries
761 resolveDomains --- whether to create an additional field for each field associated with a coded field domain.
762 skipFailures --- whether to skip failures
763 limit -- maximum number of features to read per layer
764 callback --- callback method
765 callback_data --- user data for callback
766 """
767 options = [] if options is None else options
768
769 if isinstance(options, str):
770 new_options = ParseCommandLine(options)
771 else:
772 new_options = options
773 if format is not None:
774 new_options += ['-f', format]
775 if srcSRS is not None:
776 new_options += ['-s_srs', str(srcSRS)]
777 if dstSRS is not None:
778 if reproject:
779 new_options += ['-t_srs', str(dstSRS)]
780 else:
781 new_options += ['-a_srs', str(dstSRS)]
782 if coordinateOperation is not None:
783 new_options += ['-ct', coordinateOperation]
784 if SQLStatement is not None:
785 new_options += ['-sql', str(SQLStatement)]
786 if SQLDialect is not None:
787 new_options += ['-dialect', str(SQLDialect)]
788 if where is not None:
789 new_options += ['-where', str(where)]
790 if accessMode is not None:
791 if accessMode == 'update':
792 new_options += ['-update']
793 elif accessMode == 'append':
794 new_options += ['-append']
795 elif accessMode == 'overwrite':
796 new_options += ['-overwrite']
797 else:
798 raise Exception('unhandled accessMode')
799 if addFields:
800 new_options += ['-addfields']
801 if forceNullable:
802 new_options += ['-forceNullable']
803 if emptyStrAsNull:
804 new_options += ['-emptyStrAsNull']
805 if selectFields is not None:
806 val = ''
807 for item in selectFields:
808 if val:
809 val += ','
810 val += item
811 new_options += ['-select', val]
812 if datasetCreationOptions is not None:
813 for opt in datasetCreationOptions:
814 new_options += ['-dsco', opt]
815 if layerCreationOptions is not None:
816 for opt in layerCreationOptions:
817 new_options += ['-lco', opt]
818 if layers is not None:
819 if isinstance(layers, str):
820 new_options += [layers]
821 else:
822 for lyr in layers:
823 new_options += [lyr]
824 if segmentizeMaxDist is not None:
825 new_options += ['-segmentize', str(segmentizeMaxDist)]
826 if makeValid:
827 new_options += ['-makevalid']
828 if spatFilter is not None:
829 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3])]
830 if spatSRS is not None:
831 new_options += ['-spat_srs', str(spatSRS)]
832 if layerName is not None:
833 new_options += ['-nln', layerName]
834 if geometryType is not None:
835 if isinstance(geometryType, str):
836 new_options += ['-nlt', geometryType]
837 else:
838 for opt in geometryType:
839 new_options += ['-nlt', opt]
840 if dim is not None:
841 new_options += ['-dim', dim]
842 if zField is not None:
843 new_options += ['-zfield', zField]
844 if resolveDomains:
845 new_options += ['-resolveDomains']
846 if skipFailures:
847 new_options += ['-skip']
848 if limit is not None:
849 new_options += ['-limit', str(limit)]
850 if callback is not None:
851 new_options += ['-progress']
852
853 return (GDALVectorTranslateOptions(new_options), callback, callback_data)
854
856 """ Convert one vector dataset
857 Arguments are :
858 destNameOrDestDS --- Output dataset name or object
859 srcDS --- a Dataset object or a filename
860 Keyword arguments are :
861 options --- return of gdal.VectorTranslateOptions(), string or array of strings
862 other keywords arguments of gdal.VectorTranslateOptions()
863 If options is provided as a gdal.VectorTranslateOptions() object, other keywords are ignored. """
864
865 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
866 (opts, callback, callback_data) = VectorTranslateOptions(**kwargs)
867 else:
868 (opts, callback, callback_data) = kwargs['options']
869 if isinstance(srcDS, str):
870 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR)
871
872 if isinstance(destNameOrDestDS, str):
873 return wrapper_GDALVectorTranslateDestName(destNameOrDestDS, srcDS, opts, callback, callback_data)
874 else:
875 return wrapper_GDALVectorTranslateDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
876
877 -def DEMProcessingOptions(options=None, colorFilename=None, format=None,
878 creationOptions=None, computeEdges=False, alg=None, band=1,
879 zFactor=None, scale=None, azimuth=None, altitude=None,
880 combined=False, multiDirectional=False, igor=False,
881 slopeFormat=None, trigonometric=False, zeroForFlat=False,
882 addAlpha=None, colorSelection=None,
883 callback=None, callback_data=None):
884 """ Create a DEMProcessingOptions() object that can be passed to gdal.DEMProcessing()
885 Keyword arguments are :
886 options --- can be be an array of strings, a string or let empty and filled from other keywords.
887 colorFilename --- (mandatory for "color-relief") name of file that contains palette definition for the "color-relief" processing.
888 format --- output format ("GTiff", etc...)
889 creationOptions --- list of creation options
890 computeEdges --- whether to compute values at raster edges.
891 alg --- 'Horn' (default) or 'ZevenbergenThorne' for hillshade, slope or aspect. 'Wilson' (default) or 'Riley' for TRI
892 band --- source band number to use
893 zFactor --- (hillshade only) vertical exaggeration used to pre-multiply the elevations.
894 scale --- ratio of vertical units to horizontal.
895 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.
896 altitude ---(hillshade only) altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.
897 combined --- (hillshade only) whether to compute combined shading, a combination of slope and oblique shading. Only one of combined, multiDirectional and igor can be specified.
898 multiDirectional --- (hillshade only) whether to compute multi-directional shading. Only one of combined, multiDirectional and igor can be specified.
899 igor --- (hillshade only) whether to use Igor's hillshading from Maperitive. Only one of combined, multiDirectional and igor can be specified.
900 slopeformat --- (slope only) "degree" or "percent".
901 trigonometric --- (aspect only) whether to return trigonometric angle instead of azimuth. Thus 0deg means East, 90deg North, 180deg West, 270deg South.
902 zeroForFlat --- (aspect only) whether to return 0 for flat areas with slope=0, instead of -9999.
903 addAlpha --- adds an alpha band to the output file (only for processing = 'color-relief')
904 colorSelection --- (color-relief only) Determines how color entries are selected from an input value. Can be "nearest_color_entry", "exact_color_entry" or "linear_interpolation". Defaults to "linear_interpolation"
905 callback --- callback method
906 callback_data --- user data for callback
907 """
908 options = [] if options is None else options
909
910 if isinstance(options, str):
911 new_options = ParseCommandLine(options)
912 else:
913 new_options = options
914 if format is not None:
915 new_options += ['-of', format]
916 if creationOptions is not None:
917 for opt in creationOptions:
918 new_options += ['-co', opt]
919 if computeEdges:
920 new_options += ['-compute_edges']
921 if alg:
922 new_options += ['-alg', alg]
923 new_options += ['-b', str(band)]
924 if zFactor is not None:
925 new_options += ['-z', str(zFactor)]
926 if scale is not None:
927 new_options += ['-s', str(scale)]
928 if azimuth is not None:
929 new_options += ['-az', str(azimuth)]
930 if altitude is not None:
931 new_options += ['-alt', str(altitude)]
932 if combined:
933 new_options += ['-combined']
934 if multiDirectional:
935 new_options += ['-multidirectional']
936 if igor:
937 new_options += ['-igor']
938 if slopeFormat == 'percent':
939 new_options += ['-p']
940 if trigonometric:
941 new_options += ['-trigonometric']
942 if zeroForFlat:
943 new_options += ['-zero_for_flat']
944 if colorSelection is not None:
945 if colorSelection == 'nearest_color_entry':
946 new_options += ['-nearest_color_entry']
947 elif colorSelection == 'exact_color_entry':
948 new_options += ['-exact_color_entry']
949 elif colorSelection == 'linear_interpolation':
950 pass
951 else:
952 raise ValueError("Unsupported value for colorSelection")
953 if addAlpha:
954 new_options += ['-alpha']
955
956 return (GDALDEMProcessingOptions(new_options), colorFilename, callback, callback_data)
957
959 """ Apply a DEM processing.
960 Arguments are :
961 destName --- Output dataset name
962 srcDS --- a Dataset object or a filename
963 processing --- one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness"
964 Keyword arguments are :
965 options --- return of gdal.DEMProcessingOptions(), string or array of strings
966 other keywords arguments of gdal.DEMProcessingOptions()
967 If options is provided as a gdal.DEMProcessingOptions() object, other keywords are ignored. """
968
969 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
970 (opts, colorFilename, callback, callback_data) = DEMProcessingOptions(**kwargs)
971 else:
972 (opts, colorFilename, callback, callback_data) = kwargs['options']
973 if isinstance(srcDS, str):
974 srcDS = Open(srcDS)
975
976 return DEMProcessingInternal(destName, srcDS, processing, colorFilename, opts, callback, callback_data)
977
978
979 -def NearblackOptions(options=None, format=None,
980 creationOptions=None, white = False, colors=None,
981 maxNonBlack=None, nearDist=None, setAlpha = False, setMask = False,
982 callback=None, callback_data=None):
983 """ Create a NearblackOptions() object that can be passed to gdal.Nearblack()
984 Keyword arguments are :
985 options --- can be be an array of strings, a string or let empty and filled from other keywords.
986 format --- output format ("GTiff", etc...)
987 creationOptions --- list of creation options
988 white --- whether to search for nearly white (255) pixels instead of nearly black pixels.
989 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
990 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.
991 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.
992 setAlpha --- adds an alpha band to the output file.
993 setMask --- adds a mask band to the output file.
994 callback --- callback method
995 callback_data --- user data for callback
996 """
997 options = [] if options is None else options
998
999 if isinstance(options, str):
1000 new_options = ParseCommandLine(options)
1001 else:
1002 new_options = options
1003 if format is not None:
1004 new_options += ['-of', format]
1005 if creationOptions is not None:
1006 for opt in creationOptions:
1007 new_options += ['-co', opt]
1008 if white:
1009 new_options += ['-white']
1010 if colors is not None:
1011 for color in colors:
1012 color_str = ''
1013 for cpt in color:
1014 if color_str != '':
1015 color_str += ','
1016 color_str += str(cpt)
1017 new_options += ['-color', color_str]
1018 if maxNonBlack is not None:
1019 new_options += ['-nb', str(maxNonBlack)]
1020 if nearDist is not None:
1021 new_options += ['-near', str(nearDist)]
1022 if setAlpha:
1023 new_options += ['-setalpha']
1024 if setMask:
1025 new_options += ['-setmask']
1026
1027 return (GDALNearblackOptions(new_options), callback, callback_data)
1028
1029 -def Nearblack(destNameOrDestDS, srcDS, **kwargs):
1030 """ Convert nearly black/white borders to exact value.
1031 Arguments are :
1032 destNameOrDestDS --- Output dataset name or object
1033 srcDS --- a Dataset object or a filename
1034 Keyword arguments are :
1035 options --- return of gdal.NearblackOptions(), string or array of strings
1036 other keywords arguments of gdal.NearblackOptions()
1037 If options is provided as a gdal.NearblackOptions() object, other keywords are ignored. """
1038
1039 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
1040 (opts, callback, callback_data) = NearblackOptions(**kwargs)
1041 else:
1042 (opts, callback, callback_data) = kwargs['options']
1043 if isinstance(srcDS, str):
1044 srcDS = OpenEx(srcDS)
1045
1046 if isinstance(destNameOrDestDS, str):
1047 return wrapper_GDALNearblackDestName(destNameOrDestDS, srcDS, opts, callback, callback_data)
1048 else:
1049 return wrapper_GDALNearblackDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1050
1051
1052 -def GridOptions(options=None, format=None,
1053 outputType=gdalconst.GDT_Unknown,
1054 width=0, height=0,
1055 creationOptions=None,
1056 outputBounds=None,
1057 outputSRS=None,
1058 noData=None,
1059 algorithm=None,
1060 layers=None,
1061 SQLStatement=None,
1062 where=None,
1063 spatFilter=None,
1064 zfield=None,
1065 z_increase=None,
1066 z_multiply=None,
1067 callback=None, callback_data=None):
1068 """ Create a GridOptions() object that can be passed to gdal.Grid()
1069 Keyword arguments are :
1070 options --- can be be an array of strings, a string or let empty and filled from other keywords.
1071 format --- output format ("GTiff", etc...)
1072 outputType --- output type (gdalconst.GDT_Byte, etc...)
1073 width --- width of the output raster in pixel
1074 height --- height of the output raster in pixel
1075 creationOptions --- list of creation options
1076 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry]
1077 outputSRS --- assigned output SRS
1078 noData --- nodata value
1079 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"
1080 layers --- list of layers to convert
1081 SQLStatement --- SQL statement to apply to the source dataset
1082 where --- WHERE clause to apply to source layer(s)
1083 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box
1084 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.
1085 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.
1086 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.
1087 callback --- callback method
1088 callback_data --- user data for callback
1089 """
1090 options = [] if options is None else options
1091
1092 if isinstance(options, str):
1093 new_options = ParseCommandLine(options)
1094 else:
1095 new_options = options
1096 if format is not None:
1097 new_options += ['-of', format]
1098 if outputType != gdalconst.GDT_Unknown:
1099 new_options += ['-ot', GetDataTypeName(outputType)]
1100 if width != 0 or height != 0:
1101 new_options += ['-outsize', str(width), str(height)]
1102 if creationOptions is not None:
1103 for opt in creationOptions:
1104 new_options += ['-co', opt]
1105 if outputBounds is not None:
1106 new_options += ['-txe', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[2]), '-tye', _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[3])]
1107 if outputSRS is not None:
1108 new_options += ['-a_srs', str(outputSRS)]
1109 if algorithm is not None:
1110 new_options += ['-a', algorithm]
1111 if layers is not None:
1112 if isinstance(layers, (tuple, list)):
1113 for layer in layers:
1114 new_options += ['-l', layer]
1115 else:
1116 new_options += ['-l', layers]
1117 if SQLStatement is not None:
1118 new_options += ['-sql', str(SQLStatement)]
1119 if where is not None:
1120 new_options += ['-where', str(where)]
1121 if zfield is not None:
1122 new_options += ['-zfield', zfield]
1123 if z_increase is not None:
1124 new_options += ['-z_increase', str(z_increase)]
1125 if z_multiply is not None:
1126 new_options += ['-z_multiply', str(z_multiply)]
1127 if spatFilter is not None:
1128 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3])]
1129
1130 return (GDALGridOptions(new_options), callback, callback_data)
1131
1132 -def Grid(destName, srcDS, **kwargs):
1133 """ Create raster from the scattered data.
1134 Arguments are :
1135 destName --- Output dataset name
1136 srcDS --- a Dataset object or a filename
1137 Keyword arguments are :
1138 options --- return of gdal.GridOptions(), string or array of strings
1139 other keywords arguments of gdal.GridOptions()
1140 If options is provided as a gdal.GridOptions() object, other keywords are ignored. """
1141
1142 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
1143 (opts, callback, callback_data) = GridOptions(**kwargs)
1144 else:
1145 (opts, callback, callback_data) = kwargs['options']
1146 if isinstance(srcDS, str):
1147 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR)
1148
1149 return GridInternal(destName, srcDS, opts, callback, callback_data)
1150
1151 -def RasterizeOptions(options=None, format=None,
1152 outputType=gdalconst.GDT_Unknown,
1153 creationOptions=None, noData=None, initValues=None,
1154 outputBounds=None, outputSRS=None,
1155 transformerOptions=None,
1156 width=None, height=None,
1157 xRes=None, yRes=None, targetAlignedPixels=False,
1158 bands=None, inverse=False, allTouched=False,
1159 burnValues=None, attribute=None, useZ=False, layers=None,
1160 SQLStatement=None, SQLDialect=None, where=None, optim=None,
1161 add=None,
1162 callback=None, callback_data=None):
1163 """ Create a RasterizeOptions() object that can be passed to gdal.Rasterize()
1164 Keyword arguments are :
1165 options --- can be be an array of strings, a string or let empty and filled from other keywords.
1166 format --- output format ("GTiff", etc...)
1167 outputType --- output type (gdalconst.GDT_Byte, etc...)
1168 creationOptions --- list of creation options
1169 outputBounds --- assigned output bounds: [minx, miny, maxx, maxy]
1170 outputSRS --- assigned output SRS
1171 transformerOptions --- list of transformer options
1172 width --- width of the output raster in pixel
1173 height --- height of the output raster in pixel
1174 xRes, yRes --- output resolution in target SRS
1175 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution
1176 noData --- nodata value
1177 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.
1178 bands --- list of output bands to burn values into
1179 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.
1180 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.
1181 burnValues -- list of fixed values to burn into each band for all objects. Excusive with attribute.
1182 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.
1183 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.
1184 layers --- list of layers from the datasource that will be used for input features.
1185 SQLStatement --- SQL statement to apply to the source dataset
1186 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...)
1187 where --- WHERE clause to apply to source layer(s)
1188 optim --- optimization mode ('RASTER', 'VECTOR')
1189 add --- set to True to use additive mode instead of replace when burning values
1190 callback --- callback method
1191 callback_data --- user data for callback
1192 """
1193 options = [] if options is None else options
1194
1195 if isinstance(options, str):
1196 new_options = ParseCommandLine(options)
1197 else:
1198 new_options = options
1199 if format is not None:
1200 new_options += ['-of', format]
1201 if outputType != gdalconst.GDT_Unknown:
1202 new_options += ['-ot', GetDataTypeName(outputType)]
1203 if creationOptions is not None:
1204 for opt in creationOptions:
1205 new_options += ['-co', opt]
1206 if bands is not None:
1207 for b in bands:
1208 new_options += ['-b', str(b)]
1209 if noData is not None:
1210 new_options += ['-a_nodata', str(noData)]
1211 if initValues is not None:
1212 if isinstance(initValues, (tuple, list)):
1213 for val in initValues:
1214 new_options += ['-init', str(val)]
1215 else:
1216 new_options += ['-init', str(initValues)]
1217 if outputBounds is not None:
1218 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
1219 if outputSRS is not None:
1220 new_options += ['-a_srs', str(outputSRS)]
1221 if transformerOptions is not None:
1222 for opt in transformerOptions:
1223 new_options += ['-to', opt]
1224 if width is not None and height is not None:
1225 new_options += ['-ts', str(width), str(height)]
1226 if xRes is not None and yRes is not None:
1227 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)]
1228 if targetAlignedPixels:
1229 new_options += ['-tap']
1230 if inverse:
1231 new_options += ['-i']
1232 if allTouched:
1233 new_options += ['-at']
1234 if burnValues is not None:
1235 if attribute is not None:
1236 raise Exception('burnValues and attribute option are exclusive.')
1237 if isinstance(burnValues, (tuple, list)):
1238 for val in burnValues:
1239 new_options += ['-burn', str(val)]
1240 else:
1241 new_options += ['-burn', str(burnValues)]
1242 if attribute is not None:
1243 new_options += ['-a', attribute]
1244 if useZ:
1245 new_options += ['-3d']
1246 if layers is not None:
1247 if isinstance(layers, ((tuple, list))):
1248 for layer in layers:
1249 new_options += ['-l', layer]
1250 else:
1251 new_options += ['-l', layers]
1252 if SQLStatement is not None:
1253 new_options += ['-sql', str(SQLStatement)]
1254 if SQLDialect is not None:
1255 new_options += ['-dialect', str(SQLDialect)]
1256 if where is not None:
1257 new_options += ['-where', str(where)]
1258 if optim is not None:
1259 new_options += ['-optim', str(optim)]
1260 if add:
1261 new_options += ['-add']
1262
1263 return (GDALRasterizeOptions(new_options), callback, callback_data)
1264
1265 -def Rasterize(destNameOrDestDS, srcDS, **kwargs):
1266 """ Burns vector geometries into a raster
1267 Arguments are :
1268 destNameOrDestDS --- Output dataset name or object
1269 srcDS --- a Dataset object or a filename
1270 Keyword arguments are :
1271 options --- return of gdal.RasterizeOptions(), string or array of strings
1272 other keywords arguments of gdal.RasterizeOptions()
1273 If options is provided as a gdal.RasterizeOptions() object, other keywords are ignored. """
1274
1275 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
1276 (opts, callback, callback_data) = RasterizeOptions(**kwargs)
1277 else:
1278 (opts, callback, callback_data) = kwargs['options']
1279 if isinstance(srcDS, str):
1280 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR)
1281
1282 if isinstance(destNameOrDestDS, str):
1283 return wrapper_GDALRasterizeDestName(destNameOrDestDS, srcDS, opts, callback, callback_data)
1284 else:
1285 return wrapper_GDALRasterizeDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1286
1287
1288 -def BuildVRTOptions(options=None,
1289 resolution=None,
1290 outputBounds=None,
1291 xRes=None, yRes=None,
1292 targetAlignedPixels=None,
1293 separate=None,
1294 bandList=None,
1295 addAlpha=None,
1296 resampleAlg=None,
1297 outputSRS=None,
1298 allowProjectionDifference=None,
1299 srcNodata=None,
1300 VRTNodata=None,
1301 hideNodata=None,
1302 callback=None, callback_data=None):
1303 """ Create a BuildVRTOptions() object that can be passed to gdal.BuildVRT()
1304 Keyword arguments are :
1305 options --- can be be an array of strings, a string or let empty and filled from other keywords..
1306 resolution --- 'highest', 'lowest', 'average', 'user'.
1307 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS.
1308 xRes, yRes --- output resolution in target SRS.
1309 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution.
1310 separate --- whether each source file goes into a separate stacked band in the VRT band.
1311 bandList --- array of band numbers (index start at 1).
1312 addAlpha --- whether to add an alpha mask band to the VRT when the source raster have none.
1313 resampleAlg --- resampling mode.
1314 outputSRS --- assigned output SRS.
1315 allowProjectionDifference --- whether to accept input datasets have not the same projection. Note: they will *not* be reprojected.
1316 srcNodata --- source nodata value(s).
1317 VRTNodata --- nodata values at the VRT band level.
1318 hideNodata --- whether to make the VRT band not report the NoData value.
1319 callback --- callback method.
1320 callback_data --- user data for callback.
1321 """
1322
1323
1324 return_option_list = options == '__RETURN_OPTION_LIST__'
1325 if return_option_list:
1326 options = []
1327 else:
1328 options = [] if options is None else options
1329
1330 if isinstance(options, str):
1331 new_options = ParseCommandLine(options)
1332 else:
1333 new_options = options
1334 if resolution is not None:
1335 new_options += ['-resolution', str(resolution)]
1336 if outputBounds is not None:
1337 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])]
1338 if xRes is not None and yRes is not None:
1339 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)]
1340 if targetAlignedPixels:
1341 new_options += ['-tap']
1342 if separate:
1343 new_options += ['-separate']
1344 if bandList != None:
1345 for b in bandList:
1346 new_options += ['-b', str(b)]
1347 if addAlpha:
1348 new_options += ['-addalpha']
1349 if resampleAlg is not None:
1350 if resampleAlg in mapGRIORAMethodToString:
1351 new_options += ['-r', mapGRIORAMethodToString[resampleAlg]]
1352 else:
1353 new_options += ['-r', str(resampleAlg)]
1354 if outputSRS is not None:
1355 new_options += ['-a_srs', str(outputSRS)]
1356 if allowProjectionDifference:
1357 new_options += ['-allow_projection_difference']
1358 if srcNodata is not None:
1359 new_options += ['-srcnodata', str(srcNodata)]
1360 if VRTNodata is not None:
1361 new_options += ['-vrtnodata', str(VRTNodata)]
1362 if hideNodata:
1363 new_options += ['-hidenodata']
1364
1365 if return_option_list:
1366 return new_options
1367
1368 return (GDALBuildVRTOptions(new_options), callback, callback_data)
1369
1370 -def BuildVRT(destName, srcDSOrSrcDSTab, **kwargs):
1371 """ Build a VRT from a list of datasets.
1372 Arguments are :
1373 destName --- Output dataset name
1374 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename
1375 Keyword arguments are :
1376 options --- return of gdal.BuildVRTOptions(), string or array of strings
1377 other keywords arguments of gdal.BuildVRTOptions()
1378 If options is provided as a gdal.BuildVRTOptions() object, other keywords are ignored. """
1379
1380 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
1381 (opts, callback, callback_data) = BuildVRTOptions(**kwargs)
1382 else:
1383 (opts, callback, callback_data) = kwargs['options']
1384
1385 srcDSTab = []
1386 srcDSNamesTab = []
1387 if isinstance(srcDSOrSrcDSTab, str):
1388 srcDSNamesTab = [srcDSOrSrcDSTab]
1389 elif isinstance(srcDSOrSrcDSTab, list):
1390 for elt in srcDSOrSrcDSTab:
1391 if isinstance(elt, str):
1392 srcDSNamesTab.append(elt)
1393 else:
1394 srcDSTab.append(elt)
1395 if srcDSTab and srcDSNamesTab:
1396 raise Exception('Mix of names and dataset objects not supported')
1397 else:
1398 srcDSTab = [srcDSOrSrcDSTab]
1399
1400 if srcDSTab:
1401 return BuildVRTInternalObjects(destName, srcDSTab, opts, callback, callback_data)
1402 else:
1403 return BuildVRTInternalNames(destName, srcDSNamesTab, opts, callback, callback_data)
1404
1405
1406 -def MultiDimTranslateOptions(options=None, format=None, creationOptions=None,
1407 arraySpecs=None, groupSpecs=None, subsetSpecs=None, scaleAxesSpecs=None,
1408 callback=None, callback_data=None):
1409 """ Create a MultiDimTranslateOptions() object that can be passed to gdal.MultiDimTranslate()
1410 Keyword arguments are :
1411 options --- can be be an array of strings, a string or let empty and filled from other keywords.
1412 format --- output format ("GTiff", etc...)
1413 creationOptions --- list of creation options
1414 arraySpecs -- list of array specifications, each of them being an array name or "name={src_array_name},dstname={dst_name},transpose=[1,0],view=[:,::-1]"
1415 groupSpecs -- list of group specifications, each of them being a group name or "name={src_array_name},dstname={dst_name},recursive=no"
1416 subsetSpecs -- list of subset specifications, each of them being like "{dim_name}({min_val},{max_val})" or "{dim_name}({slice_va})"
1417 scaleAxesSpecs -- list of dimension scaling specifications, each of them being like "{dim_name}({scale_factor})"
1418 callback --- callback method
1419 callback_data --- user data for callback
1420 """
1421 options = [] if options is None else options
1422
1423 if isinstance(options, str):
1424 new_options = ParseCommandLine(options)
1425 else:
1426 new_options = options
1427 if format is not None:
1428 new_options += ['-of', format]
1429 if creationOptions is not None:
1430 for opt in creationOptions:
1431 new_options += ['-co', opt]
1432 if arraySpecs is not None:
1433 for s in arraySpecs:
1434 new_options += ['-array', s]
1435 if groupSpecs is not None:
1436 for s in groupSpecs:
1437 new_options += ['-group', s]
1438 if subsetSpecs is not None:
1439 for s in subsetSpecs:
1440 new_options += ['-subset', s]
1441 if scaleAxesSpecs is not None:
1442 for s in scaleAxesSpecs:
1443 new_options += ['-scaleaxes', s]
1444
1445 return (GDALMultiDimTranslateOptions(new_options), callback, callback_data)
1446
1448 """ MultiDimTranslate one or several datasets.
1449 Arguments are :
1450 destName --- Output dataset name
1451 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename
1452 Keyword arguments are :
1453 options --- return of gdal.MultiDimTranslateOptions(), string or array of strings
1454 other keywords arguments of gdal.MultiDimTranslateOptions()
1455 If options is provided as a gdal.MultiDimTranslateOptions() object, other keywords are ignored. """
1456
1457 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)):
1458 (opts, callback, callback_data) = MultiDimTranslateOptions(**kwargs)
1459 else:
1460 (opts, callback, callback_data) = kwargs['options']
1461 if isinstance(srcDSOrSrcDSTab, str):
1462 srcDSTab = [OpenEx(srcDSOrSrcDSTab, OF_VERBOSE_ERROR | OF_RASTER | OF_MULTIDIM_RASTER)]
1463 elif isinstance(srcDSOrSrcDSTab, list):
1464 srcDSTab = []
1465 for elt in srcDSOrSrcDSTab:
1466 if isinstance(elt, str):
1467 srcDSTab.append(OpenEx(elt, OF_VERBOSE_ERROR | OF_RASTER | OF_MULTIDIM_RASTER))
1468 else:
1469 srcDSTab.append(elt)
1470 else:
1471 srcDSTab = [srcDSOrSrcDSTab]
1472
1473 return wrapper_GDALMultiDimTranslateDestName(destName, srcDSTab, opts, callback, callback_data)
1474
1475
1485
1510
1511
1513 """EscapeString(string_or_bytes, scheme = gdal.CPLES_SQL)"""
1514 if isinstance(args[0], bytes):
1515 return _gdal.EscapeBinary(*args, **kwargs)
1516 else:
1517 return _gdal.wrapper_EscapeString(*args, **kwargs)
1518
1519
1521 """ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) -> Dataset"""
1522
1523 from warnings import warn
1524 warn('ApplyVerticalShiftGrid() will be removed in GDAL 4.0', DeprecationWarning)
1525 return _ApplyVerticalShiftGrid(*args, **kwargs)
1526
1527
1528
1530 """Debug(char const * msg_class, char const * message)"""
1531 return _gdal.Debug(*args)
1532
1534 """SetErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr"""
1535 return _gdal.SetErrorHandler(*args)
1536
1540
1542 """PushErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr"""
1543 return _gdal.PushErrorHandler(*args)
1544
1548
1550 """Error(CPLErr msg_class, int err_code=0, char const * msg)"""
1551 return _gdal.Error(*args)
1552
1556
1558 """GOA2GetRefreshToken(char const * pszAuthToken, char const * pszScope) -> retStringAndCPLFree *"""
1559 return _gdal.GOA2GetRefreshToken(*args)
1560
1562 """GOA2GetAccessToken(char const * pszRefreshToken, char const * pszScope) -> retStringAndCPLFree *"""
1563 return _gdal.GOA2GetAccessToken(*args)
1564
1568
1570 """wrapper_EscapeString(int len, int scheme) -> retStringAndCPLFree *"""
1571 return _gdal.wrapper_EscapeString(*args, **kwargs)
1572
1574 """EscapeBinary(int len, int scheme)"""
1575 return _gdal.EscapeBinary(*args, **kwargs)
1576
1580
1584
1588
1592
1596
1600
1604
1608
1612
1616
1618 """FindFile(char const * pszClass, char const * utf8_path) -> char const *"""
1619 return _gdal.FindFile(*args)
1620
1622 """ReadDir(char const * utf8_path, int nMaxFiles=0) -> char **"""
1623 return _gdal.ReadDir(*args)
1624
1628
1630 """OpenDir(char const * utf8_path, int nRecurseDepth=-1, char ** options=None) -> VSIDIR *"""
1631 return _gdal.OpenDir(*args)
1632 -class DirEntry(_object):
1633 """Proxy of C++ DirEntry class."""
1634
1635 __swig_setmethods__ = {}
1636 __setattr__ = lambda self, name, value: _swig_setattr(self, DirEntry, name, value)
1637 __swig_getmethods__ = {}
1638 __getattr__ = lambda self, name: _swig_getattr(self, DirEntry, name)
1639 __repr__ = _swig_repr
1640 __swig_getmethods__["name"] = _gdal.DirEntry_name_get
1641 if _newclass:
1642 name = _swig_property(_gdal.DirEntry_name_get)
1643 __swig_getmethods__["mode"] = _gdal.DirEntry_mode_get
1644 if _newclass:
1645 mode = _swig_property(_gdal.DirEntry_mode_get)
1646 __swig_getmethods__["size"] = _gdal.DirEntry_size_get
1647 if _newclass:
1648 size = _swig_property(_gdal.DirEntry_size_get)
1649 __swig_getmethods__["mtime"] = _gdal.DirEntry_mtime_get
1650 if _newclass:
1651 mtime = _swig_property(_gdal.DirEntry_mtime_get)
1652 __swig_getmethods__["modeKnown"] = _gdal.DirEntry_modeKnown_get
1653 if _newclass:
1654 modeKnown = _swig_property(_gdal.DirEntry_modeKnown_get)
1655 __swig_getmethods__["sizeKnown"] = _gdal.DirEntry_sizeKnown_get
1656 if _newclass:
1657 sizeKnown = _swig_property(_gdal.DirEntry_sizeKnown_get)
1658 __swig_getmethods__["mtimeKnown"] = _gdal.DirEntry_mtimeKnown_get
1659 if _newclass:
1660 mtimeKnown = _swig_property(_gdal.DirEntry_mtimeKnown_get)
1661 __swig_getmethods__["extra"] = _gdal.DirEntry_extra_get
1662 if _newclass:
1663 extra = _swig_property(_gdal.DirEntry_extra_get)
1664
1665 - def __init__(self, *args):
1666 """__init__(DirEntry self, DirEntry entryIn) -> DirEntry"""
1667 this = _gdal.new_DirEntry(*args)
1668 try:
1669 self.this.append(this)
1670 except __builtin__.Exception:
1671 self.this = this
1672 __swig_destroy__ = _gdal.delete_DirEntry
1673 __del__ = lambda self: None
1674
1675 - def IsDirectory(self, *args):
1676 """IsDirectory(DirEntry self) -> bool"""
1677 return _gdal.DirEntry_IsDirectory(self, *args)
1678
1679 DirEntry_swigregister = _gdal.DirEntry_swigregister
1680 DirEntry_swigregister(DirEntry)
1681
1682
1683 -def GetNextDirEntry(*args):
1684 """GetNextDirEntry(VSIDIR * dir) -> DirEntry"""
1685 return _gdal.GetNextDirEntry(*args)
1686
1688 """CloseDir(VSIDIR * dir)"""
1689 return _gdal.CloseDir(*args)
1690
1692 """SetConfigOption(char const * pszKey, char const * pszValue)"""
1693 return _gdal.SetConfigOption(*args)
1694
1698
1700 """GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *"""
1701 return _gdal.GetConfigOption(*args)
1702
1704 """GetThreadLocalConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *"""
1705 return _gdal.GetThreadLocalConfigOption(*args)
1706
1708 """CPLBinaryToHex(int nBytes) -> retStringAndCPLFree *"""
1709 return _gdal.CPLBinaryToHex(*args)
1710
1712 """CPLHexToBinary(char const * pszHex, int * pnBytes) -> GByte *"""
1713 return _gdal.CPLHexToBinary(*args)
1714
1716 """FileFromMemBuffer(char const * utf8_path, GIntBig nBytes)"""
1717 return _gdal.FileFromMemBuffer(*args)
1718
1720 """Unlink(char const * utf8_path) -> VSI_RETVAL"""
1721 return _gdal.Unlink(*args)
1722
1724 """UnlinkBatch(char ** files) -> bool"""
1725 return _gdal.UnlinkBatch(*args)
1726
1730
1732 """Mkdir(char const * utf8_path, int mode) -> VSI_RETVAL"""
1733 return _gdal.Mkdir(*args)
1734
1736 """Rmdir(char const * utf8_path) -> VSI_RETVAL"""
1737 return _gdal.Rmdir(*args)
1738
1740 """MkdirRecursive(char const * utf8_path, int mode) -> VSI_RETVAL"""
1741 return _gdal.MkdirRecursive(*args)
1742
1744 """RmdirRecursive(char const * utf8_path) -> VSI_RETVAL"""
1745 return _gdal.RmdirRecursive(*args)
1746
1748 """Rename(char const * pszOld, char const * pszNew) -> VSI_RETVAL"""
1749 return _gdal.Rename(*args)
1750
1751 -def Sync(*args, **kwargs):
1752 """Sync(char const * pszSource, char const * pszTarget, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> bool"""
1753 return _gdal.Sync(*args, **kwargs)
1754
1758
1760 """GetActualURL(char const * utf8_path) -> char const *"""
1761 return _gdal.GetActualURL(*args)
1762
1764 """GetSignedURL(char const * utf8_path, char ** options=None) -> retStringAndCPLFree *"""
1765 return _gdal.GetSignedURL(*args)
1766
1770
1785 VSILFILE_swigregister = _gdal.VSILFILE_swigregister
1786 VSILFILE_swigregister(VSILFILE)
1787
1788 VSI_STAT_EXISTS_FLAG = _gdal.VSI_STAT_EXISTS_FLAG
1789 VSI_STAT_NATURE_FLAG = _gdal.VSI_STAT_NATURE_FLAG
1790 VSI_STAT_SIZE_FLAG = _gdal.VSI_STAT_SIZE_FLAG
1791 VSI_STAT_SET_ERROR_FLAG = _gdal.VSI_STAT_SET_ERROR_FLAG
1792 VSI_STAT_CACHE_ONLY = _gdal.VSI_STAT_CACHE_ONLY
1794 """Proxy of C++ StatBuf class."""
1795
1796 __swig_setmethods__ = {}
1797 __setattr__ = lambda self, name, value: _swig_setattr(self, StatBuf, name, value)
1798 __swig_getmethods__ = {}
1799 __getattr__ = lambda self, name: _swig_getattr(self, StatBuf, name)
1800 __repr__ = _swig_repr
1801 __swig_getmethods__["mode"] = _gdal.StatBuf_mode_get
1802 if _newclass:
1803 mode = _swig_property(_gdal.StatBuf_mode_get)
1804 __swig_getmethods__["size"] = _gdal.StatBuf_size_get
1805 if _newclass:
1806 size = _swig_property(_gdal.StatBuf_size_get)
1807 __swig_getmethods__["mtime"] = _gdal.StatBuf_mtime_get
1808 if _newclass:
1809 mtime = _swig_property(_gdal.StatBuf_mtime_get)
1810
1812 """__init__(StatBuf self, StatBuf psStatBuf) -> StatBuf"""
1813 this = _gdal.new_StatBuf(*args)
1814 try:
1815 self.this.append(this)
1816 except __builtin__.Exception:
1817 self.this = this
1818 __swig_destroy__ = _gdal.delete_StatBuf
1819 __del__ = lambda self: None
1820
1822 """IsDirectory(StatBuf self) -> int"""
1823 return _gdal.StatBuf_IsDirectory(self, *args)
1824
1825 StatBuf_swigregister = _gdal.StatBuf_swigregister
1826 StatBuf_swigregister(StatBuf)
1827
1828
1830 """VSIStatL(char const * utf8_path, int nFlags=0) -> int"""
1831 return _gdal.VSIStatL(*args)
1832
1836
1840
1842 """VSIFOpenL(char const * utf8_path, char const * pszMode) -> VSILFILE"""
1843 return _gdal.VSIFOpenL(*args)
1844
1846 """VSIFOpenExL(char const * utf8_path, char const * pszMode, int bSetError=False, char ** options=None) -> VSILFILE"""
1847 return _gdal.VSIFOpenExL(*args)
1848
1850 """VSIFEofL(VSILFILE fp) -> int"""
1851 return _gdal.VSIFEofL(*args)
1852
1854 """VSIFFlushL(VSILFILE fp) -> int"""
1855 return _gdal.VSIFFlushL(*args)
1856
1858 """VSIFCloseL(VSILFILE fp) -> VSI_RETVAL"""
1859 return _gdal.VSIFCloseL(*args)
1860
1862 """VSIFSeekL(VSILFILE fp, GIntBig offset, int whence) -> int"""
1863 return _gdal.VSIFSeekL(*args)
1864
1866 """VSIFTellL(VSILFILE fp) -> GIntBig"""
1867 return _gdal.VSIFTellL(*args)
1868
1870 """VSIFTruncateL(VSILFILE fp, GIntBig length) -> int"""
1871 return _gdal.VSIFTruncateL(*args)
1872
1876 VSI_RANGE_STATUS_UNKNOWN = _gdal.VSI_RANGE_STATUS_UNKNOWN
1877 VSI_RANGE_STATUS_DATA = _gdal.VSI_RANGE_STATUS_DATA
1878 VSI_RANGE_STATUS_HOLE = _gdal.VSI_RANGE_STATUS_HOLE
1879
1881 """VSIFGetRangeStatusL(VSILFILE fp, GIntBig offset, GIntBig length) -> int"""
1882 return _gdal.VSIFGetRangeStatusL(*args)
1883
1885 """VSIFWriteL(int nLen, int size, int memb, VSILFILE fp) -> int"""
1886 return _gdal.VSIFWriteL(*args)
1887
1891
1895
1899
1903
1908 """Proxy of C++ GDALMajorObjectShadow class."""
1909
1910 __swig_setmethods__ = {}
1911 __setattr__ = lambda self, name, value: _swig_setattr(self, MajorObject, name, value)
1912 __swig_getmethods__ = {}
1913 __getattr__ = lambda self, name: _swig_getattr(self, MajorObject, name)
1914
1916 raise AttributeError("No constructor defined")
1917 __repr__ = _swig_repr
1918
1920 """GetDescription(MajorObject self) -> char const *"""
1921 return _gdal.MajorObject_GetDescription(self, *args)
1922
1923
1925 """SetDescription(MajorObject self, char const * pszNewDesc)"""
1926 return _gdal.MajorObject_SetDescription(self, *args)
1927
1928
1930 """GetMetadataDomainList(MajorObject self) -> char **"""
1931 return _gdal.MajorObject_GetMetadataDomainList(self, *args)
1932
1933
1937
1938
1942
1943
1950
1951
1955
1956
1960
1961
1966
1967 MajorObject_swigregister = _gdal.MajorObject_swigregister
1968 MajorObject_swigregister(MajorObject)
1969
1971 """Proxy of C++ GDALDriverShadow class."""
1972
1973 __swig_setmethods__ = {}
1974 for _s in [MajorObject]:
1975 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
1976 __setattr__ = lambda self, name, value: _swig_setattr(self, Driver, name, value)
1977 __swig_getmethods__ = {}
1978 for _s in [MajorObject]:
1979 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
1980 __getattr__ = lambda self, name: _swig_getattr(self, Driver, name)
1981
1983 raise AttributeError("No constructor defined")
1984 __repr__ = _swig_repr
1985 __swig_getmethods__["ShortName"] = _gdal.Driver_ShortName_get
1986 if _newclass:
1987 ShortName = _swig_property(_gdal.Driver_ShortName_get)
1988 __swig_getmethods__["LongName"] = _gdal.Driver_LongName_get
1989 if _newclass:
1990 LongName = _swig_property(_gdal.Driver_LongName_get)
1991 __swig_getmethods__["HelpTopic"] = _gdal.Driver_HelpTopic_get
1992 if _newclass:
1993 HelpTopic = _swig_property(_gdal.Driver_HelpTopic_get)
1994
1995 - def Create(self, *args, **kwargs):
1996 """Create(Driver self, char const * utf8_path, int xsize, int ysize, int bands=1, GDALDataType eType, char ** options=None) -> Dataset"""
1997 return _gdal.Driver_Create(self, *args, **kwargs)
1998
1999
2001 """CreateMultiDimensional(Driver self, char const * utf8_path, char ** root_group_options=None, char ** options=None) -> Dataset"""
2002 return _gdal.Driver_CreateMultiDimensional(self, *args, **kwargs)
2003
2004
2006 """CreateCopy(Driver self, char const * utf8_path, Dataset src, int strict=1, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
2007 return _gdal.Driver_CreateCopy(self, *args, **kwargs)
2008
2009
2011 """Delete(Driver self, char const * utf8_path) -> CPLErr"""
2012 return _gdal.Driver_Delete(self, *args)
2013
2014
2016 """Rename(Driver self, char const * newName, char const * oldName) -> CPLErr"""
2017 return _gdal.Driver_Rename(self, *args)
2018
2019
2021 """CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr"""
2022 return _gdal.Driver_CopyFiles(self, *args)
2023
2024
2026 """Register(Driver self) -> int"""
2027 return _gdal.Driver_Register(self, *args)
2028
2029
2031 """Deregister(Driver self)"""
2032 return _gdal.Driver_Deregister(self, *args)
2033
2034 Driver_swigregister = _gdal.Driver_swigregister
2035 Driver_swigregister(Driver)
2036
2037 from sys import version_info as _swig_python_version_info
2038 if _swig_python_version_info >= (2, 7, 0):
2039 from . import ogr
2040 else:
2041 import ogr
2042 del _swig_python_version_info
2043 from sys import version_info as _swig_python_version_info
2044 if _swig_python_version_info >= (2, 7, 0):
2045 from . import osr
2046 else:
2047 import osr
2048 del _swig_python_version_info
2049 -class ColorEntry(_object):
2050 """Proxy of C++ GDALColorEntry class."""
2051
2052 __swig_setmethods__ = {}
2053 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorEntry, name, value)
2054 __swig_getmethods__ = {}
2055 __getattr__ = lambda self, name: _swig_getattr(self, ColorEntry, name)
2056
2057 - def __init__(self, *args, **kwargs):
2058 raise AttributeError("No constructor defined")
2059 __repr__ = _swig_repr
2060 __swig_setmethods__["c1"] = _gdal.ColorEntry_c1_set
2061 __swig_getmethods__["c1"] = _gdal.ColorEntry_c1_get
2062 if _newclass:
2063 c1 = _swig_property(_gdal.ColorEntry_c1_get, _gdal.ColorEntry_c1_set)
2064 __swig_setmethods__["c2"] = _gdal.ColorEntry_c2_set
2065 __swig_getmethods__["c2"] = _gdal.ColorEntry_c2_get
2066 if _newclass:
2067 c2 = _swig_property(_gdal.ColorEntry_c2_get, _gdal.ColorEntry_c2_set)
2068 __swig_setmethods__["c3"] = _gdal.ColorEntry_c3_set
2069 __swig_getmethods__["c3"] = _gdal.ColorEntry_c3_get
2070 if _newclass:
2071 c3 = _swig_property(_gdal.ColorEntry_c3_get, _gdal.ColorEntry_c3_set)
2072 __swig_setmethods__["c4"] = _gdal.ColorEntry_c4_set
2073 __swig_getmethods__["c4"] = _gdal.ColorEntry_c4_get
2074 if _newclass:
2075 c4 = _swig_property(_gdal.ColorEntry_c4_get, _gdal.ColorEntry_c4_set)
2076 ColorEntry_swigregister = _gdal.ColorEntry_swigregister
2077 ColorEntry_swigregister(ColorEntry)
2078
2079 -class GCP(_object):
2080 """Proxy of C++ GDAL_GCP class."""
2081
2082 __swig_setmethods__ = {}
2083 __setattr__ = lambda self, name, value: _swig_setattr(self, GCP, name, value)
2084 __swig_getmethods__ = {}
2085 __getattr__ = lambda self, name: _swig_getattr(self, GCP, name)
2086 __repr__ = _swig_repr
2087 __swig_setmethods__["GCPX"] = _gdal.GCP_GCPX_set
2088 __swig_getmethods__["GCPX"] = _gdal.GCP_GCPX_get
2089 if _newclass:
2090 GCPX = _swig_property(_gdal.GCP_GCPX_get, _gdal.GCP_GCPX_set)
2091 __swig_setmethods__["GCPY"] = _gdal.GCP_GCPY_set
2092 __swig_getmethods__["GCPY"] = _gdal.GCP_GCPY_get
2093 if _newclass:
2094 GCPY = _swig_property(_gdal.GCP_GCPY_get, _gdal.GCP_GCPY_set)
2095 __swig_setmethods__["GCPZ"] = _gdal.GCP_GCPZ_set
2096 __swig_getmethods__["GCPZ"] = _gdal.GCP_GCPZ_get
2097 if _newclass:
2098 GCPZ = _swig_property(_gdal.GCP_GCPZ_get, _gdal.GCP_GCPZ_set)
2099 __swig_setmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_set
2100 __swig_getmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_get
2101 if _newclass:
2102 GCPPixel = _swig_property(_gdal.GCP_GCPPixel_get, _gdal.GCP_GCPPixel_set)
2103 __swig_setmethods__["GCPLine"] = _gdal.GCP_GCPLine_set
2104 __swig_getmethods__["GCPLine"] = _gdal.GCP_GCPLine_get
2105 if _newclass:
2106 GCPLine = _swig_property(_gdal.GCP_GCPLine_get, _gdal.GCP_GCPLine_set)
2107 __swig_setmethods__["Info"] = _gdal.GCP_Info_set
2108 __swig_getmethods__["Info"] = _gdal.GCP_Info_get
2109 if _newclass:
2110 Info = _swig_property(_gdal.GCP_Info_get, _gdal.GCP_Info_set)
2111 __swig_setmethods__["Id"] = _gdal.GCP_Id_set
2112 __swig_getmethods__["Id"] = _gdal.GCP_Id_get
2113 if _newclass:
2114 Id = _swig_property(_gdal.GCP_Id_get, _gdal.GCP_Id_set)
2115
2117 """__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"""
2118 this = _gdal.new_GCP(*args)
2119 try:
2120 self.this.append(this)
2121 except __builtin__.Exception:
2122 self.this = this
2123 __swig_destroy__ = _gdal.delete_GCP
2124 __del__ = lambda self: None
2125
2127 str = '%s (%.2fP,%.2fL) -> (%.7fE,%.7fN,%.2f) %s '\
2128 % (self.Id, self.GCPPixel, self.GCPLine,
2129 self.GCPX, self.GCPY, self.GCPZ, self.Info )
2130 return str
2131
2133 base = [gdalconst.CXT_Element,'GCP']
2134 base.append([gdalconst.CXT_Attribute,'Id',[gdalconst.CXT_Text,self.Id]])
2135 pixval = '%0.15E' % self.GCPPixel
2136 lineval = '%0.15E' % self.GCPLine
2137 xval = '%0.15E' % self.GCPX
2138 yval = '%0.15E' % self.GCPY
2139 zval = '%0.15E' % self.GCPZ
2140 base.append([gdalconst.CXT_Attribute,'Pixel',[gdalconst.CXT_Text,pixval]])
2141 base.append([gdalconst.CXT_Attribute,'Line',[gdalconst.CXT_Text,lineval]])
2142 base.append([gdalconst.CXT_Attribute,'X',[gdalconst.CXT_Text,xval]])
2143 base.append([gdalconst.CXT_Attribute,'Y',[gdalconst.CXT_Text,yval]])
2144 if with_Z:
2145 base.append([gdalconst.CXT_Attribute,'Z',[gdalconst.CXT_Text,zval]])
2146 return base
2147
2148 GCP_swigregister = _gdal.GCP_swigregister
2149 GCP_swigregister(GCP)
2150
2151
2155
2159
2163
2167
2171
2175
2179
2183
2187
2191
2195
2199
2203
2207
2212 """Proxy of C++ CPLVirtualMemShadow class."""
2213
2214 __swig_setmethods__ = {}
2215 __setattr__ = lambda self, name, value: _swig_setattr(self, VirtualMem, name, value)
2216 __swig_getmethods__ = {}
2217 __getattr__ = lambda self, name: _swig_getattr(self, VirtualMem, name)
2218
2220 raise AttributeError("No constructor defined")
2221 __repr__ = _swig_repr
2222 __swig_destroy__ = _gdal.delete_VirtualMem
2223 __del__ = lambda self: None
2224
2226 """GetAddr(VirtualMem self)"""
2227 return _gdal.VirtualMem_GetAddr(self, *args)
2228
2229
2230 - def Pin(self, *args):
2231 """Pin(VirtualMem self, size_t start_offset=0, size_t nsize=0, int bWriteOp=0)"""
2232 return _gdal.VirtualMem_Pin(self, *args)
2233
2234 VirtualMem_swigregister = _gdal.VirtualMem_swigregister
2235 VirtualMem_swigregister(VirtualMem)
2236
2238 """Proxy of C++ GDALAsyncReaderShadow class."""
2239
2240 __swig_setmethods__ = {}
2241 __setattr__ = lambda self, name, value: _swig_setattr(self, AsyncReader, name, value)
2242 __swig_getmethods__ = {}
2243 __getattr__ = lambda self, name: _swig_getattr(self, AsyncReader, name)
2244
2246 raise AttributeError("No constructor defined")
2247 __repr__ = _swig_repr
2248 __swig_destroy__ = _gdal.delete_AsyncReader
2249 __del__ = lambda self: None
2250
2252 """GetNextUpdatedRegion(AsyncReader self, double timeout) -> GDALAsyncStatusType"""
2253 return _gdal.AsyncReader_GetNextUpdatedRegion(self, *args)
2254
2255
2257 """GetBuffer(AsyncReader self)"""
2258 return _gdal.AsyncReader_GetBuffer(self, *args)
2259
2260
2262 """LockBuffer(AsyncReader self, double timeout) -> int"""
2263 return _gdal.AsyncReader_LockBuffer(self, *args)
2264
2265
2267 """UnlockBuffer(AsyncReader self)"""
2268 return _gdal.AsyncReader_UnlockBuffer(self, *args)
2269
2270 AsyncReader_swigregister = _gdal.AsyncReader_swigregister
2271 AsyncReader_swigregister(AsyncReader)
2272
2274 """Proxy of C++ GDALDatasetShadow class."""
2275
2276 __swig_setmethods__ = {}
2277 for _s in [MajorObject]:
2278 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
2279 __setattr__ = lambda self, name, value: _swig_setattr(self, Dataset, name, value)
2280 __swig_getmethods__ = {}
2281 for _s in [MajorObject]:
2282 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
2283 __getattr__ = lambda self, name: _swig_getattr(self, Dataset, name)
2284
2286 raise AttributeError("No constructor defined")
2287 __repr__ = _swig_repr
2288 __swig_getmethods__["RasterXSize"] = _gdal.Dataset_RasterXSize_get
2289 if _newclass:
2290 RasterXSize = _swig_property(_gdal.Dataset_RasterXSize_get)
2291 __swig_getmethods__["RasterYSize"] = _gdal.Dataset_RasterYSize_get
2292 if _newclass:
2293 RasterYSize = _swig_property(_gdal.Dataset_RasterYSize_get)
2294 __swig_getmethods__["RasterCount"] = _gdal.Dataset_RasterCount_get
2295 if _newclass:
2296 RasterCount = _swig_property(_gdal.Dataset_RasterCount_get)
2297 __swig_destroy__ = _gdal.delete_Dataset
2298 __del__ = lambda self: None
2299
2301 """GetDriver(Dataset self) -> Driver"""
2302 return _gdal.Dataset_GetDriver(self, *args)
2303
2304
2306 """GetRasterBand(Dataset self, int nBand) -> Band"""
2307 return _gdal.Dataset_GetRasterBand(self, *args)
2308
2309
2311 """GetRootGroup(Dataset self) -> Group"""
2312 return _gdal.Dataset_GetRootGroup(self, *args)
2313
2314
2316 """GetProjection(Dataset self) -> char const *"""
2317 return _gdal.Dataset_GetProjection(self, *args)
2318
2319
2321 """GetProjectionRef(Dataset self) -> char const *"""
2322 return _gdal.Dataset_GetProjectionRef(self, *args)
2323
2324
2326 """GetSpatialRef(Dataset self) -> SpatialReference"""
2327 return _gdal.Dataset_GetSpatialRef(self, *args)
2328
2329
2331 """SetProjection(Dataset self, char const * prj) -> CPLErr"""
2332 return _gdal.Dataset_SetProjection(self, *args)
2333
2334
2336 """SetSpatialRef(Dataset self, SpatialReference srs) -> CPLErr"""
2337 return _gdal.Dataset_SetSpatialRef(self, *args)
2338
2339
2343
2344
2348
2349
2351 """BuildOverviews(Dataset self, char const * resampling, int overviewlist=0, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
2352 return _gdal.Dataset_BuildOverviews(self, *args, **kwargs)
2353
2354
2356 """GetGCPCount(Dataset self) -> int"""
2357 return _gdal.Dataset_GetGCPCount(self, *args)
2358
2359
2361 """GetGCPProjection(Dataset self) -> char const *"""
2362 return _gdal.Dataset_GetGCPProjection(self, *args)
2363
2364
2366 """GetGCPSpatialRef(Dataset self) -> SpatialReference"""
2367 return _gdal.Dataset_GetGCPSpatialRef(self, *args)
2368
2369
2371 """GetGCPs(Dataset self)"""
2372 return _gdal.Dataset_GetGCPs(self, *args)
2373
2374
2376 """_SetGCPs(Dataset self, int nGCPs, char const * pszGCPProjection) -> CPLErr"""
2377 return _gdal.Dataset__SetGCPs(self, *args)
2378
2379
2381 """_SetGCPs2(Dataset self, int nGCPs, SpatialReference hSRS) -> CPLErr"""
2382 return _gdal.Dataset__SetGCPs2(self, *args)
2383
2384
2386 """FlushCache(Dataset self)"""
2387 return _gdal.Dataset_FlushCache(self, *args)
2388
2389
2390 - def AddBand(self, *args, **kwargs):
2391 """AddBand(Dataset self, GDALDataType datatype, char ** options=None) -> CPLErr"""
2392 return _gdal.Dataset_AddBand(self, *args, **kwargs)
2393
2394
2396 """CreateMaskBand(Dataset self, int nFlags) -> CPLErr"""
2397 return _gdal.Dataset_CreateMaskBand(self, *args)
2398
2399
2401 """GetFileList(Dataset self) -> char **"""
2402 return _gdal.Dataset_GetFileList(self, *args)
2403
2404
2406 """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"""
2407 return _gdal.Dataset_WriteRaster(self, *args, **kwargs)
2408
2409
2411 """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"""
2412 return _gdal.Dataset_AdviseRead(self, *args)
2413
2414
2416 """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"""
2417 return _gdal.Dataset_BeginAsyncReader(self, *args, **kwargs)
2418
2419
2421 """EndAsyncReader(Dataset self, AsyncReader ario)"""
2422 return _gdal.Dataset_EndAsyncReader(self, *args)
2423
2424
2426 """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"""
2427 return _gdal.Dataset_GetVirtualMem(self, *args, **kwargs)
2428
2429
2431 """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"""
2432 return _gdal.Dataset_GetTiledVirtualMem(self, *args, **kwargs)
2433
2434
2436 """CreateLayer(Dataset self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type, char ** options=None) -> Layer"""
2437 return _gdal.Dataset_CreateLayer(self, *args, **kwargs)
2438
2439
2441 """CopyLayer(Dataset self, Layer src_layer, char const * new_name, char ** options=None) -> Layer"""
2442 return _gdal.Dataset_CopyLayer(self, *args, **kwargs)
2443
2444
2446 """DeleteLayer(Dataset self, int index) -> OGRErr"""
2447 return _gdal.Dataset_DeleteLayer(self, *args)
2448
2449
2451 """GetLayerCount(Dataset self) -> int"""
2452 return _gdal.Dataset_GetLayerCount(self, *args)
2453
2454
2456 """IsLayerPrivate(Dataset self, int index) -> bool"""
2457 return _gdal.Dataset_IsLayerPrivate(self, *args)
2458
2459
2461 """GetLayerByIndex(Dataset self, int index=0) -> Layer"""
2462 return _gdal.Dataset_GetLayerByIndex(self, *args)
2463
2464
2466 """GetLayerByName(Dataset self, char const * layer_name) -> Layer"""
2467 return _gdal.Dataset_GetLayerByName(self, *args)
2468
2469
2471 """ResetReading(Dataset self)"""
2472 return _gdal.Dataset_ResetReading(self, *args)
2473
2474
2476 """GetNextFeature(Dataset self, bool include_layer=True, bool include_pct=False, GDALProgressFunc callback=0, void * callback_data=None) -> Feature"""
2477 return _gdal.Dataset_GetNextFeature(self, *args, **kwargs)
2478
2479
2481 """TestCapability(Dataset self, char const * cap) -> bool"""
2482 return _gdal.Dataset_TestCapability(self, *args)
2483
2484
2486 """ExecuteSQL(Dataset self, char const * statement, Geometry spatialFilter=None, char const * dialect) -> Layer"""
2487 return _gdal.Dataset_ExecuteSQL(self, *args, **kwargs)
2488
2489
2491 """ReleaseResultSet(Dataset self, Layer layer)"""
2492 return _gdal.Dataset_ReleaseResultSet(self, *args)
2493
2494
2496 """GetStyleTable(Dataset self) -> StyleTable"""
2497 return _gdal.Dataset_GetStyleTable(self, *args)
2498
2499
2501 """SetStyleTable(Dataset self, StyleTable table)"""
2502 return _gdal.Dataset_SetStyleTable(self, *args)
2503
2504
2506 """AbortSQL(Dataset self) -> OGRErr"""
2507 return _gdal.Dataset_AbortSQL(self, *args)
2508
2509
2511 """StartTransaction(Dataset self, int force=False) -> OGRErr"""
2512 return _gdal.Dataset_StartTransaction(self, *args, **kwargs)
2513
2514
2516 """CommitTransaction(Dataset self) -> OGRErr"""
2517 return _gdal.Dataset_CommitTransaction(self, *args)
2518
2519
2521 """RollbackTransaction(Dataset self) -> OGRErr"""
2522 return _gdal.Dataset_RollbackTransaction(self, *args)
2523
2524
2526 """ClearStatistics(Dataset self)"""
2527 return _gdal.Dataset_ClearStatistics(self, *args)
2528
2529
2530 - def GetFieldDomain(self, *args):
2531 """GetFieldDomain(Dataset self, char const * name) -> FieldDomain"""
2532 return _gdal.Dataset_GetFieldDomain(self, *args)
2533
2534
2535 - def AddFieldDomain(self, *args):
2536 """AddFieldDomain(Dataset self, FieldDomain fieldDomain) -> bool"""
2537 return _gdal.Dataset_AddFieldDomain(self, *args)
2538
2539
2541 """ReadRaster1(Dataset self, double xoff, double yoff, double xsize, double 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, void * inputOutputBuf=None) -> CPLErr"""
2542 return _gdal.Dataset_ReadRaster1(self, *args, **kwargs)
2543
2544
2545
2546 - def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None, buf_obj=None,
2547 buf_xsize=None, buf_ysize=None, buf_type=None,
2548 resample_alg=gdalconst.GRIORA_NearestNeighbour,
2549 callback=None,
2550 callback_data=None,
2551 interleave='band',
2552 band_list=None):
2553 """ Reading a chunk of a GDAL band into a numpy array. The optional (buf_xsize,buf_ysize,buf_type)
2554 parameters should generally not be specified if buf_obj is specified. The array is returned"""
2555
2556 from osgeo import gdal_array
2557 return gdal_array.DatasetReadAsArray(self, xoff, yoff, xsize, ysize, buf_obj,
2558 buf_xsize, buf_ysize, buf_type,
2559 resample_alg=resample_alg,
2560 callback=callback,
2561 callback_data=callback_data,
2562 interleave=interleave,
2563 band_list=band_list)
2564
2571 from osgeo import gdal_array
2572
2573 return gdal_array.DatasetWriteArray(self, array, xoff, yoff,
2574 band_list=band_list,
2575 interleave=interleave,
2576 resample_alg=resample_alg,
2577 callback=callback,
2578 callback_data=callback_data)
2579
2580 - def WriteRaster(self, xoff, yoff, xsize, ysize,
2581 buf_string,
2582 buf_xsize=None, buf_ysize=None, buf_type=None,
2583 band_list=None,
2584 buf_pixel_space=None, buf_line_space=None, buf_band_space=None ):
2585
2586 if buf_xsize is None:
2587 buf_xsize = xsize
2588 if buf_ysize is None:
2589 buf_ysize = ysize
2590 if band_list is None:
2591 band_list = list(range(1, self.RasterCount + 1))
2592
2593
2594
2595 if type(buf_string).__name__ == 'ndarray' and \
2596 buf_xsize == xsize and buf_ysize == ysize and buf_type is None and \
2597 buf_pixel_space is None and buf_line_space is None and buf_band_space is None:
2598 return self.WriteArray(buf_string, xoff=xoff, yoff=yoff,
2599 band_list=band_list)
2600 if buf_type is None:
2601 buf_type = self.GetRasterBand(1).DataType
2602
2603 return _gdal.Dataset_WriteRaster(self,
2604 xoff, yoff, xsize, ysize,
2605 buf_string, buf_xsize, buf_ysize, buf_type, band_list,
2606 buf_pixel_space, buf_line_space, buf_band_space )
2607
2608 - def ReadRaster(self, xoff=0, yoff=0, xsize=None, ysize=None,
2609 buf_xsize=None, buf_ysize=None, buf_type=None,
2610 band_list=None,
2611 buf_pixel_space=None, buf_line_space=None, buf_band_space=None,
2612 resample_alg=gdalconst.GRIORA_NearestNeighbour,
2613 callback=None,
2614 callback_data=None,
2615 buf_obj=None):
2616
2617 if xsize is None:
2618 xsize = self.RasterXSize
2619 if ysize is None:
2620 ysize = self.RasterYSize
2621 if band_list is None:
2622 band_list = list(range(1, self.RasterCount + 1))
2623 if buf_xsize is None:
2624 buf_xsize = xsize
2625 if buf_ysize is None:
2626 buf_ysize = ysize
2627
2628 if buf_type is None:
2629 buf_type = self.GetRasterBand(1).DataType;
2630
2631 return _gdal.Dataset_ReadRaster1(self, xoff, yoff, xsize, ysize,
2632 buf_xsize, buf_ysize, buf_type,
2633 band_list, buf_pixel_space, buf_line_space, buf_band_space,
2634 resample_alg, callback, callback_data, buf_obj )
2635
2636 - def GetVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0,
2637 xsize=None, ysize=None, bufxsize=None, bufysize=None,
2638 datatype=None, band_list=None, band_sequential = True,
2639 cache_size = 10 * 1024 * 1024, page_size_hint = 0,
2640 options=None):
2641 """Return a NumPy array for the dataset, seen as a virtual memory mapping.
2642 If there are several bands and band_sequential = True, an element is
2643 accessed with array[band][y][x].
2644 If there are several bands and band_sequential = False, an element is
2645 accessed with array[y][x][band].
2646 If there is only one band, an element is accessed with array[y][x].
2647 Any reference to the array must be dropped before the last reference to the
2648 related dataset is also dropped.
2649 """
2650 from osgeo import gdal_array
2651 if xsize is None:
2652 xsize = self.RasterXSize
2653 if ysize is None:
2654 ysize = self.RasterYSize
2655 if bufxsize is None:
2656 bufxsize = self.RasterXSize
2657 if bufysize is None:
2658 bufysize = self.RasterYSize
2659 if datatype is None:
2660 datatype = self.GetRasterBand(1).DataType
2661 if band_list is None:
2662 band_list = list(range(1, self.RasterCount + 1))
2663 if options is None:
2664 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, band_list, band_sequential, cache_size, page_size_hint)
2665 else:
2666 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, band_list, band_sequential, cache_size, page_size_hint, options)
2667 return gdal_array.VirtualMemGetArray( virtualmem )
2668
2669 - def GetTiledVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0,
2670 xsize=None, ysize=None, tilexsize=256, tileysize=256,
2671 datatype=None, band_list=None, tile_organization=gdalconst.GTO_BSQ,
2672 cache_size = 10 * 1024 * 1024, options=None):
2673 """Return a NumPy array for the dataset, seen as a virtual memory mapping with
2674 a tile organization.
2675 If there are several bands and tile_organization = gdal.GTO_TIP, an element is
2676 accessed with array[tiley][tilex][y][x][band].
2677 If there are several bands and tile_organization = gdal.GTO_BIT, an element is
2678 accessed with array[tiley][tilex][band][y][x].
2679 If there are several bands and tile_organization = gdal.GTO_BSQ, an element is
2680 accessed with array[band][tiley][tilex][y][x].
2681 If there is only one band, an element is accessed with array[tiley][tilex][y][x].
2682 Any reference to the array must be dropped before the last reference to the
2683 related dataset is also dropped.
2684 """
2685 from osgeo import gdal_array
2686 if xsize is None:
2687 xsize = self.RasterXSize
2688 if ysize is None:
2689 ysize = self.RasterYSize
2690 if datatype is None:
2691 datatype = self.GetRasterBand(1).DataType
2692 if band_list is None:
2693 band_list = list(range(1, self.RasterCount + 1))
2694 if options is None:
2695 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,band_list,tile_organization,cache_size)
2696 else:
2697 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,band_list,tile_organization,cache_size, options)
2698 return gdal_array.VirtualMemGetArray( virtualmem )
2699
2701 sd_list = []
2702
2703 sd = self.GetMetadata('SUBDATASETS')
2704 if sd is None:
2705 return sd_list
2706
2707 i = 1
2708 while 'SUBDATASET_'+str(i)+'_NAME' in sd:
2709 sd_list.append((sd['SUBDATASET_'+str(i)+'_NAME'],
2710 sd['SUBDATASET_'+str(i)+'_DESC']))
2711 i = i + 1
2712 return sd_list
2713
2714 - def BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj=None, buf_xsize=None, buf_ysize=None, buf_type=None, band_list=None, options=None):
2715 if band_list is None:
2716 band_list = list(range(1, self.RasterCount + 1))
2717 if buf_xsize is None:
2718 buf_xsize = 0;
2719 if buf_ysize is None:
2720 buf_ysize = 0;
2721 if buf_type is None:
2722 buf_type = gdalconst.GDT_Byte
2723
2724 if buf_xsize <= 0:
2725 buf_xsize = xsize
2726 if buf_ysize <= 0:
2727 buf_ysize = ysize
2728 options = [] if options is None else options
2729
2730 if buf_obj is None:
2731 from sys import version_info
2732 nRequiredSize = int(buf_xsize * buf_ysize * len(band_list) * (_gdal.GetDataTypeSize(buf_type) / 8))
2733 if version_info >= (3, 0, 0):
2734 buf_obj_ar = [None]
2735 exec("buf_obj_ar[0] = b' ' * nRequiredSize")
2736 buf_obj = buf_obj_ar[0]
2737 else:
2738 buf_obj = ' ' * nRequiredSize
2739 return _gdal.Dataset_BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj, buf_xsize, buf_ysize, buf_type, band_list, 0, 0, 0, options)
2740
2742 """Return the layer given an index or a name"""
2743 if isinstance(iLayer, str):
2744 return self.GetLayerByName(str(iLayer))
2745 elif isinstance(iLayer, int):
2746 return self.GetLayerByIndex(iLayer)
2747 else:
2748 raise TypeError("Input %s is not of String or Int type" % type(iLayer))
2749
2751 """Deletes the layer given an index or layer name"""
2752 if isinstance(value, str):
2753 for i in range(self.GetLayerCount()):
2754 name = self.GetLayer(i).GetName()
2755 if name == value:
2756 return _gdal.Dataset_DeleteLayer(self, i)
2757 raise ValueError("Layer %s not found to delete" % value)
2758 elif isinstance(value, int):
2759 return _gdal.Dataset_DeleteLayer(self, value)
2760 else:
2761 raise TypeError("Input %s is not of String or Int type" % type(value))
2762
2763 - def SetGCPs(self, gcps, wkt_or_spatial_ref):
2764 if isinstance(wkt_or_spatial_ref, str):
2765 return self._SetGCPs(gcps, wkt_or_spatial_ref)
2766 else:
2767 return self._SetGCPs2(gcps, wkt_or_spatial_ref)
2768
2769 Dataset_swigregister = _gdal.Dataset_swigregister
2770 Dataset_swigregister(Dataset)
2771
2772 GEDTST_NONE = _gdal.GEDTST_NONE
2773 GEDTST_JSON = _gdal.GEDTST_JSON
2775 """Proxy of C++ GDALGroupHS class."""
2776
2777 __swig_setmethods__ = {}
2778 __setattr__ = lambda self, name, value: _swig_setattr(self, Group, name, value)
2779 __swig_getmethods__ = {}
2780 __getattr__ = lambda self, name: _swig_getattr(self, Group, name)
2781
2783 raise AttributeError("No constructor defined")
2784 __repr__ = _swig_repr
2785 __swig_destroy__ = _gdal.delete_Group
2786 __del__ = lambda self: None
2787
2789 """GetName(Group self) -> char const *"""
2790 return _gdal.Group_GetName(self, *args)
2791
2792
2794 """GetFullName(Group self) -> char const *"""
2795 return _gdal.Group_GetFullName(self, *args)
2796
2797
2799 """GetMDArrayNames(Group self, char ** options=None) -> char **"""
2800 return _gdal.Group_GetMDArrayNames(self, *args)
2801
2802
2804 """OpenMDArray(Group self, char const * name, char ** options=None) -> MDArray"""
2805 return _gdal.Group_OpenMDArray(self, *args)
2806
2807
2809 """OpenMDArrayFromFullname(Group self, char const * name, char ** options=None) -> MDArray"""
2810 return _gdal.Group_OpenMDArrayFromFullname(self, *args)
2811
2812
2814 """ResolveMDArray(Group self, char const * name, char const * starting_point, char ** options=None) -> MDArray"""
2815 return _gdal.Group_ResolveMDArray(self, *args)
2816
2817
2819 """GetGroupNames(Group self, char ** options=None) -> char **"""
2820 return _gdal.Group_GetGroupNames(self, *args)
2821
2822
2824 """OpenGroup(Group self, char const * name, char ** options=None) -> Group"""
2825 return _gdal.Group_OpenGroup(self, *args)
2826
2827
2829 """OpenGroupFromFullname(Group self, char const * name, char ** options=None) -> Group"""
2830 return _gdal.Group_OpenGroupFromFullname(self, *args)
2831
2832
2834 """GetVectorLayerNames(Group self, char ** options=None) -> char **"""
2835 return _gdal.Group_GetVectorLayerNames(self, *args)
2836
2837
2839 """OpenVectorLayer(Group self, char const * name, char ** options=None) -> Layer"""
2840 return _gdal.Group_OpenVectorLayer(self, *args)
2841
2842
2844 """GetDimensions(Group self, char ** options=None)"""
2845 return _gdal.Group_GetDimensions(self, *args)
2846
2847
2849 """GetAttribute(Group self, char const * name) -> Attribute"""
2850 return _gdal.Group_GetAttribute(self, *args)
2851
2852
2854 """GetAttributes(Group self, char ** options=None)"""
2855 return _gdal.Group_GetAttributes(self, *args)
2856
2857
2859 """GetStructuralInfo(Group self) -> char **"""
2860 return _gdal.Group_GetStructuralInfo(self, *args)
2861
2862
2864 """CreateGroup(Group self, char const * name, char ** options=None) -> Group"""
2865 return _gdal.Group_CreateGroup(self, *args)
2866
2867
2869 """CreateDimension(Group self, char const * name, char const * type, char const * direction, unsigned long long size, char ** options=None) -> Dimension"""
2870 return _gdal.Group_CreateDimension(self, *args)
2871
2872
2874 """CreateMDArray(Group self, char const * name, int nDimensions, ExtendedDataType data_type, char ** options=None) -> MDArray"""
2875 return _gdal.Group_CreateMDArray(self, *args)
2876
2877
2879 """CreateAttribute(Group self, char const * name, int nDimensions, ExtendedDataType data_type, char ** options=None) -> Attribute"""
2880 return _gdal.Group_CreateAttribute(self, *args)
2881
2882 Group_swigregister = _gdal.Group_swigregister
2883 Group_swigregister(Group)
2884
2918 Statistics_swigregister = _gdal.Statistics_swigregister
2919 Statistics_swigregister(Statistics)
2920
2922 """Proxy of C++ GDALMDArrayHS class."""
2923
2924 __swig_setmethods__ = {}
2925 __setattr__ = lambda self, name, value: _swig_setattr(self, MDArray, name, value)
2926 __swig_getmethods__ = {}
2927 __getattr__ = lambda self, name: _swig_getattr(self, MDArray, name)
2928
2930 raise AttributeError("No constructor defined")
2931 __repr__ = _swig_repr
2932 __swig_destroy__ = _gdal.delete_MDArray
2933 __del__ = lambda self: None
2934
2936 """GetName(MDArray self) -> char const *"""
2937 return _gdal.MDArray_GetName(self, *args)
2938
2939
2941 """GetFullName(MDArray self) -> char const *"""
2942 return _gdal.MDArray_GetFullName(self, *args)
2943
2944
2946 """GetTotalElementsCount(MDArray self) -> unsigned long long"""
2947 return _gdal.MDArray_GetTotalElementsCount(self, *args)
2948
2949
2951 """GetDimensionCount(MDArray self) -> size_t"""
2952 return _gdal.MDArray_GetDimensionCount(self, *args)
2953
2954
2956 """GetDimensions(MDArray self)"""
2957 return _gdal.MDArray_GetDimensions(self, *args)
2958
2959
2961 """GetCoordinateVariables(MDArray self)"""
2962 return _gdal.MDArray_GetCoordinateVariables(self, *args)
2963
2964
2966 """GetBlockSize(MDArray self)"""
2967 return _gdal.MDArray_GetBlockSize(self, *args)
2968
2969
2971 """GetProcessingChunkSize(MDArray self, size_t nMaxChunkMemory)"""
2972 return _gdal.MDArray_GetProcessingChunkSize(self, *args)
2973
2974
2976 """GetDataType(MDArray self) -> ExtendedDataType"""
2977 return _gdal.MDArray_GetDataType(self, *args)
2978
2979
2981 """GetStructuralInfo(MDArray self) -> char **"""
2982 return _gdal.MDArray_GetStructuralInfo(self, *args)
2983
2984
2985 - def Read(self, *args):
2986 """Read(MDArray self, int nDims1, int nDims2, int nDims3, int nDims4, ExtendedDataType buffer_datatype) -> CPLErr"""
2987 return _gdal.MDArray_Read(self, *args)
2988
2989
2991 """WriteStringArray(MDArray self, int nDims1, int nDims2, int nDims3, ExtendedDataType buffer_datatype, char ** options) -> CPLErr"""
2992 return _gdal.MDArray_WriteStringArray(self, *args)
2993
2994
2995 - def Write(self, *args):
2996 """Write(MDArray self, int nDims1, int nDims2, int nDims3, int nDims4, ExtendedDataType buffer_datatype, GIntBig buf_len) -> CPLErr"""
2997 return _gdal.MDArray_Write(self, *args)
2998
2999
3001 """AdviseRead(MDArray self, int nDims1, int nDims2, char ** options=None) -> CPLErr"""
3002 return _gdal.MDArray_AdviseRead(self, *args)
3003
3004
3006 """GetAttribute(MDArray self, char const * name) -> Attribute"""
3007 return _gdal.MDArray_GetAttribute(self, *args)
3008
3009
3011 """GetAttributes(MDArray self, char ** options=None)"""
3012 return _gdal.MDArray_GetAttributes(self, *args)
3013
3014
3016 """CreateAttribute(MDArray self, char const * name, int nDimensions, ExtendedDataType data_type, char ** options=None) -> Attribute"""
3017 return _gdal.MDArray_CreateAttribute(self, *args)
3018
3019
3021 """GetNoDataValueAsRaw(MDArray self) -> CPLErr"""
3022 return _gdal.MDArray_GetNoDataValueAsRaw(self, *args)
3023
3024
3026 """GetNoDataValueAsDouble(MDArray self)"""
3027 return _gdal.MDArray_GetNoDataValueAsDouble(self, *args)
3028
3029
3031 """GetNoDataValueAsString(MDArray self) -> retStringAndCPLFree *"""
3032 return _gdal.MDArray_GetNoDataValueAsString(self, *args)
3033
3034
3036 """SetNoDataValueDouble(MDArray self, double d) -> CPLErr"""
3037 return _gdal.MDArray_SetNoDataValueDouble(self, *args)
3038
3039
3041 """SetNoDataValueString(MDArray self, char const * nodata) -> CPLErr"""
3042 return _gdal.MDArray_SetNoDataValueString(self, *args)
3043
3044
3046 """SetNoDataValueRaw(MDArray self, GIntBig nLen) -> CPLErr"""
3047 return _gdal.MDArray_SetNoDataValueRaw(self, *args)
3048
3049
3051 """DeleteNoDataValue(MDArray self) -> CPLErr"""
3052 return _gdal.MDArray_DeleteNoDataValue(self, *args)
3053
3054
3056 """GetOffset(MDArray self)"""
3057 return _gdal.MDArray_GetOffset(self, *args)
3058
3059
3061 """GetOffsetStorageType(MDArray self) -> GDALDataType"""
3062 return _gdal.MDArray_GetOffsetStorageType(self, *args)
3063
3064
3066 """GetScale(MDArray self)"""
3067 return _gdal.MDArray_GetScale(self, *args)
3068
3069
3071 """GetScaleStorageType(MDArray self) -> GDALDataType"""
3072 return _gdal.MDArray_GetScaleStorageType(self, *args)
3073
3074
3076 """SetOffset(MDArray self, double val, GDALDataType storageType) -> CPLErr"""
3077 return _gdal.MDArray_SetOffset(self, *args, **kwargs)
3078
3079
3081 """SetScale(MDArray self, double val, GDALDataType storageType) -> CPLErr"""
3082 return _gdal.MDArray_SetScale(self, *args, **kwargs)
3083
3084
3086 """SetUnit(MDArray self, char const * unit) -> CPLErr"""
3087 return _gdal.MDArray_SetUnit(self, *args)
3088
3089
3091 """GetUnit(MDArray self) -> char const *"""
3092 return _gdal.MDArray_GetUnit(self, *args)
3093
3094
3096 """SetSpatialRef(MDArray self, SpatialReference srs) -> OGRErr"""
3097 return _gdal.MDArray_SetSpatialRef(self, *args)
3098
3099
3101 """GetSpatialRef(MDArray self) -> SpatialReference"""
3102 return _gdal.MDArray_GetSpatialRef(self, *args)
3103
3104
3106 """GetView(MDArray self, char const * viewExpr) -> MDArray"""
3107 return _gdal.MDArray_GetView(self, *args)
3108
3109
3111 """Transpose(MDArray self, int nList) -> MDArray"""
3112 return _gdal.MDArray_Transpose(self, *args)
3113
3114
3116 """GetUnscaled(MDArray self) -> MDArray"""
3117 return _gdal.MDArray_GetUnscaled(self, *args)
3118
3119
3121 """GetMask(MDArray self, char ** options=None) -> MDArray"""
3122 return _gdal.MDArray_GetMask(self, *args)
3123
3124
3126 """AsClassicDataset(MDArray self, size_t iXDim, size_t iYDim) -> Dataset"""
3127 return _gdal.MDArray_AsClassicDataset(self, *args)
3128
3129
3131 """GetStatistics(MDArray self, bool approx_ok=False, bool force=True, GDALProgressFunc callback=0, void * callback_data=None) -> Statistics"""
3132 return _gdal.MDArray_GetStatistics(self, *args, **kwargs)
3133
3134
3136 """ComputeStatistics(MDArray self, bool approx_ok=False, GDALProgressFunc callback=0, void * callback_data=None) -> Statistics"""
3137 return _gdal.MDArray_ComputeStatistics(self, *args, **kwargs)
3138
3139
3141 """GetResampled(MDArray self, int nDimensions, GDALRIOResampleAlg resample_alg, OSRSpatialReferenceShadow ** srs, char ** options=None) -> MDArray"""
3142 return _gdal.MDArray_GetResampled(self, *args)
3143
3144
3145 - def Cache(self, *args):
3146 """Cache(MDArray self, char ** options=None) -> bool"""
3147 return _gdal.MDArray_Cache(self, *args)
3148
3149
3150 - def Read(self,
3151 array_start_idx = None,
3152 count = None,
3153 array_step = None,
3154 buffer_stride = None,
3155 buffer_datatype = None):
3156 if not array_start_idx:
3157 array_start_idx = [0] * self.GetDimensionCount()
3158 if not count:
3159 count = [ dim.GetSize() for dim in self.GetDimensions() ]
3160 if not array_step:
3161 array_step = [1] * self.GetDimensionCount()
3162 if not buffer_stride:
3163 stride = 1
3164 buffer_stride = []
3165
3166
3167 for cnt in reversed(count):
3168 buffer_stride.append(stride)
3169 stride *= cnt
3170 buffer_stride.reverse()
3171 if not buffer_datatype:
3172 buffer_datatype = self.GetDataType()
3173 return _gdal.MDArray_Read(self, array_start_idx, count, array_step, buffer_stride, buffer_datatype)
3174
3175 - def ReadAsArray(self,
3176 array_start_idx = None,
3177 count = None,
3178 array_step = None,
3179 buffer_datatype = None,
3180 buf_obj = None):
3184
3185 - def AdviseRead(self, array_start_idx = None, count = None, options = []):
3191
3193
3194 def stringify(v):
3195 if v == Ellipsis:
3196 return '...'
3197 if isinstance(v, slice):
3198 return ':'.join([str(x) if x is not None else '' for x in (v.start, v.stop, v.step)])
3199 if isinstance(v, str):
3200 return v
3201 if isinstance(v, (int, type(12345678901234))):
3202 return str(v)
3203 try:
3204 import numpy as np
3205 if v == np.newaxis:
3206 return 'newaxis'
3207 except:
3208 pass
3209
3210 return str(v)
3211
3212 if isinstance(item, str):
3213 return self.GetView('["' + item.replace('\\', '\\\\').replace('"', '\\"') + '"]')
3214 elif isinstance(item, slice):
3215 return self.GetView('[' + stringify(item) + ']')
3216 elif isinstance(item, tuple):
3217 return self.GetView('[' + ','.join([stringify(x) for x in item]) + ']')
3218 else:
3219 return self.GetView('[' + stringify(item) + ']')
3220
3221 - def Write(self,
3222 buffer,
3223 array_start_idx = None,
3224 count = None,
3225 array_step = None,
3226 buffer_stride = None,
3227 buffer_datatype = None):
3228
3229 dimCount = self.GetDimensionCount()
3230
3231
3232
3233 if type(buffer).__name__ == 'ndarray' and \
3234 count is None and buffer_stride is None and buffer_datatype is None:
3235 return self.WriteArray(buffer, array_start_idx=array_start_idx, array_step=array_step)
3236
3237
3238 if dimCount == 1 and type(buffer).__name__ == 'array' and \
3239 count is None and buffer_stride is None and buffer_datatype is None:
3240 map_typecode_itemsize_to_gdal = {
3241 ('B',1): GDT_Byte,
3242 ('h',2): GDT_Int16,
3243 ('H',2): GDT_UInt16,
3244 ('i',4): GDT_Int32,
3245 ('I',4): GDT_UInt32,
3246 ('l',4): GDT_Int32,
3247
3248
3249
3250 ('f', 4): GDT_Float32,
3251 ('d', 8): GDT_Float64
3252 }
3253 key = (buffer.typecode, buffer.itemsize)
3254 if key not in map_typecode_itemsize_to_gdal:
3255 raise Exception("unhandled type for buffer of type array")
3256 buffer_datatype = ExtendedDataType.Create(map_typecode_itemsize_to_gdal[key])
3257
3258
3259 elif dimCount == 1 and type(buffer) == type([]) and len(buffer) != 0 \
3260 and self.GetDataType().GetClass() != GEDTC_STRING:
3261 buffer_datatype = GDT_Int32
3262 for v in buffer:
3263 if isinstance(v, int):
3264 if v >= (1 << 31) or v < -(1 << 31):
3265 buffer_datatype = GDT_Float64
3266 elif isinstance(v, float):
3267 buffer_datatype = GDT_Float64
3268 else:
3269 raise ValueError('Only lists with integer or float elements are supported')
3270 import array
3271 buffer = array.array('d' if buffer_datatype == GDT_Float64 else 'i', buffer)
3272 buffer_datatype = ExtendedDataType.Create(buffer_datatype)
3273
3274 if not buffer_datatype:
3275 buffer_datatype = self.GetDataType()
3276
3277 is_1d_string = self.GetDataType().GetClass() == GEDTC_STRING and buffer_datatype.GetClass() == GEDTC_STRING and dimCount == 1
3278
3279 if not array_start_idx:
3280 array_start_idx = [0] * dimCount
3281
3282 if not count:
3283 if is_1d_string:
3284 assert type(buffer) == type([])
3285 count = [ len(buffer) ]
3286 else:
3287 count = [ dim.GetSize() for dim in self.GetDimensions() ]
3288
3289 if not array_step:
3290 array_step = [1] * dimCount
3291
3292 if not buffer_stride:
3293 stride = 1
3294 buffer_stride = []
3295
3296
3297 for cnt in reversed(count):
3298 buffer_stride.append(stride)
3299 stride *= cnt
3300 buffer_stride.reverse()
3301
3302 if is_1d_string:
3303 return _gdal.MDArray_WriteStringArray(self, array_start_idx, count, array_step, buffer_datatype, buffer)
3304
3305 return _gdal.MDArray_Write(self, array_start_idx, count, array_step, buffer_stride, buffer_datatype, buffer)
3306
3307 - def WriteArray(self, array,
3308 array_start_idx = None,
3309 array_step = None):
3313
3314 - def ReadAsMaskedArray(self,
3315 array_start_idx = None,
3316 count = None,
3317 array_step = None):
3318 """ Return a numpy masked array of ReadAsArray() with GetMask() """
3319 import numpy
3320 mask = self.GetMask()
3321 if mask is not None:
3322 array = self.ReadAsArray(array_start_idx, count, array_step)
3323 mask_array = mask.ReadAsArray(array_start_idx, count, array_step)
3324 bool_array = ~mask_array.astype(bool)
3325 return numpy.ma.array(array, mask=bool_array)
3326 else:
3327 return numpy.ma.array(self.ReadAsArray(array_start_idx, count, array_step), mask=None)
3328
3330 """ Return the shape of the array """
3331 if not self.GetDimensionCount():
3332 return None
3333 shp = ()
3334 for dim in self.GetDimensions():
3335 shp += (dim.GetSize(),)
3336 return shp
3337
3338 shape = property(fget=GetShape, doc='Returns the shape of the array.')
3339
3340
3341 MDArray_swigregister = _gdal.MDArray_swigregister
3342 MDArray_swigregister(MDArray)
3343
3345 """Proxy of C++ GDALAttributeHS class."""
3346
3347 __swig_setmethods__ = {}
3348 __setattr__ = lambda self, name, value: _swig_setattr(self, Attribute, name, value)
3349 __swig_getmethods__ = {}
3350 __getattr__ = lambda self, name: _swig_getattr(self, Attribute, name)
3351
3353 raise AttributeError("No constructor defined")
3354 __repr__ = _swig_repr
3355 __swig_destroy__ = _gdal.delete_Attribute
3356 __del__ = lambda self: None
3357
3359 """GetName(Attribute self) -> char const *"""
3360 return _gdal.Attribute_GetName(self, *args)
3361
3362
3364 """GetFullName(Attribute self) -> char const *"""
3365 return _gdal.Attribute_GetFullName(self, *args)
3366
3367
3369 """GetTotalElementsCount(Attribute self) -> unsigned long long"""
3370 return _gdal.Attribute_GetTotalElementsCount(self, *args)
3371
3372
3374 """GetDimensionCount(Attribute self) -> size_t"""
3375 return _gdal.Attribute_GetDimensionCount(self, *args)
3376
3377
3379 """GetDimensionsSize(Attribute self)"""
3380 return _gdal.Attribute_GetDimensionsSize(self, *args)
3381
3382
3384 """GetDataType(Attribute self) -> ExtendedDataType"""
3385 return _gdal.Attribute_GetDataType(self, *args)
3386
3387
3389 """ReadAsRaw(Attribute self) -> CPLErr"""
3390 return _gdal.Attribute_ReadAsRaw(self, *args)
3391
3392
3394 """ReadAsString(Attribute self) -> char const *"""
3395 return _gdal.Attribute_ReadAsString(self, *args)
3396
3397
3399 """ReadAsInt(Attribute self) -> int"""
3400 return _gdal.Attribute_ReadAsInt(self, *args)
3401
3402
3404 """ReadAsDouble(Attribute self) -> double"""
3405 return _gdal.Attribute_ReadAsDouble(self, *args)
3406
3407
3409 """ReadAsStringArray(Attribute self) -> char **"""
3410 return _gdal.Attribute_ReadAsStringArray(self, *args)
3411
3412
3414 """ReadAsIntArray(Attribute self)"""
3415 return _gdal.Attribute_ReadAsIntArray(self, *args)
3416
3417
3419 """ReadAsDoubleArray(Attribute self)"""
3420 return _gdal.Attribute_ReadAsDoubleArray(self, *args)
3421
3422
3424 """WriteRaw(Attribute self, GIntBig nLen) -> CPLErr"""
3425 return _gdal.Attribute_WriteRaw(self, *args)
3426
3427
3429 """WriteString(Attribute self, char const * val) -> CPLErr"""
3430 return _gdal.Attribute_WriteString(self, *args)
3431
3432
3434 """WriteStringArray(Attribute self, char ** vals) -> CPLErr"""
3435 return _gdal.Attribute_WriteStringArray(self, *args)
3436
3437
3439 """WriteInt(Attribute self, int val) -> CPLErr"""
3440 return _gdal.Attribute_WriteInt(self, *args)
3441
3442
3444 """WriteDouble(Attribute self, double val) -> CPLErr"""
3445 return _gdal.Attribute_WriteDouble(self, *args)
3446
3447
3449 """WriteDoubleArray(Attribute self, int nList) -> CPLErr"""
3450 return _gdal.Attribute_WriteDoubleArray(self, *args)
3451
3452
3453
3481
3483 if isinstance(val, (int, type(12345678901234))):
3484 if val >= -0x80000000 and val <= 0x7FFFFFFF:
3485 return self.WriteInt(val)
3486 else:
3487 return self.WriteDouble(val)
3488 if isinstance(val, float):
3489 return self.WriteDouble(val)
3490 if isinstance(val, str) and self.GetDataType().GetClass() != GEDTC_COMPOUND:
3491 return self.WriteString(val)
3492 if isinstance(val, list):
3493 if len(val) == 0:
3494 if self.GetDataType().GetClass() == GEDTC_STRING:
3495 return self.WriteStringArray(val)
3496 else:
3497 return self.WriteDoubleArray(val)
3498 if isinstance(val[0], (int, type(12345678901234), float)):
3499 return self.WriteDoubleArray(val)
3500 if isinstance(val[0], str):
3501 return self.WriteStringArray(val)
3502 if isinstance(val, dict) and self.GetDataType().GetSubType() == GEDTST_JSON:
3503 import json
3504 return self.WriteString(json.dumps(val))
3505 return self.WriteRaw(val)
3506
3507
3508 Attribute_swigregister = _gdal.Attribute_swigregister
3509 Attribute_swigregister(Attribute)
3510
3512 """Proxy of C++ GDALDimensionHS class."""
3513
3514 __swig_setmethods__ = {}
3515 __setattr__ = lambda self, name, value: _swig_setattr(self, Dimension, name, value)
3516 __swig_getmethods__ = {}
3517 __getattr__ = lambda self, name: _swig_getattr(self, Dimension, name)
3518
3520 raise AttributeError("No constructor defined")
3521 __repr__ = _swig_repr
3522 __swig_destroy__ = _gdal.delete_Dimension
3523 __del__ = lambda self: None
3524
3526 """GetName(Dimension self) -> char const *"""
3527 return _gdal.Dimension_GetName(self, *args)
3528
3529
3531 """GetFullName(Dimension self) -> char const *"""
3532 return _gdal.Dimension_GetFullName(self, *args)
3533
3534
3536 """GetType(Dimension self) -> char const *"""
3537 return _gdal.Dimension_GetType(self, *args)
3538
3539
3541 """GetDirection(Dimension self) -> char const *"""
3542 return _gdal.Dimension_GetDirection(self, *args)
3543
3544
3546 """GetSize(Dimension self) -> unsigned long long"""
3547 return _gdal.Dimension_GetSize(self, *args)
3548
3549
3551 """GetIndexingVariable(Dimension self) -> MDArray"""
3552 return _gdal.Dimension_GetIndexingVariable(self, *args)
3553
3554
3556 """SetIndexingVariable(Dimension self, MDArray array) -> bool"""
3557 return _gdal.Dimension_SetIndexingVariable(self, *args)
3558
3559 Dimension_swigregister = _gdal.Dimension_swigregister
3560 Dimension_swigregister(Dimension)
3561
3562 GEDTC_NUMERIC = _gdal.GEDTC_NUMERIC
3563 GEDTC_STRING = _gdal.GEDTC_STRING
3564 GEDTC_COMPOUND = _gdal.GEDTC_COMPOUND
3566 """Proxy of C++ GDALExtendedDataTypeHS class."""
3567
3568 __swig_setmethods__ = {}
3569 __setattr__ = lambda self, name, value: _swig_setattr(self, ExtendedDataType, name, value)
3570 __swig_getmethods__ = {}
3571 __getattr__ = lambda self, name: _swig_getattr(self, ExtendedDataType, name)
3572
3574 raise AttributeError("No constructor defined")
3575 __repr__ = _swig_repr
3576 __swig_destroy__ = _gdal.delete_ExtendedDataType
3577 __del__ = lambda self: None
3578
3582
3583 Create = staticmethod(Create)
3584
3586 """CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE) -> ExtendedDataType"""
3587 return _gdal.ExtendedDataType_CreateString(*args)
3588
3589 CreateString = staticmethod(CreateString)
3590
3594
3595 CreateCompound = staticmethod(CreateCompound)
3596
3598 """GetName(ExtendedDataType self) -> char const *"""
3599 return _gdal.ExtendedDataType_GetName(self, *args)
3600
3601
3603 """GetClass(ExtendedDataType self) -> GDALExtendedDataTypeClass"""
3604 return _gdal.ExtendedDataType_GetClass(self, *args)
3605
3606
3608 """GetNumericDataType(ExtendedDataType self) -> GDALDataType"""
3609 return _gdal.ExtendedDataType_GetNumericDataType(self, *args)
3610
3611
3613 """GetSize(ExtendedDataType self) -> size_t"""
3614 return _gdal.ExtendedDataType_GetSize(self, *args)
3615
3616
3618 """GetMaxStringLength(ExtendedDataType self) -> size_t"""
3619 return _gdal.ExtendedDataType_GetMaxStringLength(self, *args)
3620
3621
3623 """GetSubType(ExtendedDataType self) -> GDALExtendedDataTypeSubType"""
3624 return _gdal.ExtendedDataType_GetSubType(self, *args)
3625
3626
3628 """GetComponents(ExtendedDataType self)"""
3629 return _gdal.ExtendedDataType_GetComponents(self, *args)
3630
3631
3633 """CanConvertTo(ExtendedDataType self, ExtendedDataType other) -> bool"""
3634 return _gdal.ExtendedDataType_CanConvertTo(self, *args)
3635
3636
3638 """Equals(ExtendedDataType self, ExtendedDataType other) -> bool"""
3639 return _gdal.ExtendedDataType_Equals(self, *args)
3640
3641
3642
3644 return self.Equals(other)
3645
3647 return not self.__eq__(other)
3648
3649 ExtendedDataType_swigregister = _gdal.ExtendedDataType_swigregister
3650 ExtendedDataType_swigregister(ExtendedDataType)
3651
3655
3657 """ExtendedDataType_CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE) -> ExtendedDataType"""
3658 return _gdal.ExtendedDataType_CreateString(*args)
3659
3663
3665 """Proxy of C++ GDALEDTComponentHS class."""
3666
3667 __swig_setmethods__ = {}
3668 __setattr__ = lambda self, name, value: _swig_setattr(self, EDTComponent, name, value)
3669 __swig_getmethods__ = {}
3670 __getattr__ = lambda self, name: _swig_getattr(self, EDTComponent, name)
3671
3673 raise AttributeError("No constructor defined")
3674 __repr__ = _swig_repr
3675 __swig_destroy__ = _gdal.delete_EDTComponent
3676 __del__ = lambda self: None
3677
3679 """Create(char const * name, size_t offset, ExtendedDataType type) -> EDTComponent"""
3680 return _gdal.EDTComponent_Create(*args)
3681
3682 Create = staticmethod(Create)
3683
3685 """GetName(EDTComponent self) -> char const *"""
3686 return _gdal.EDTComponent_GetName(self, *args)
3687
3688
3690 """GetOffset(EDTComponent self) -> size_t"""
3691 return _gdal.EDTComponent_GetOffset(self, *args)
3692
3693
3695 """GetType(EDTComponent self) -> ExtendedDataType"""
3696 return _gdal.EDTComponent_GetType(self, *args)
3697
3698 EDTComponent_swigregister = _gdal.EDTComponent_swigregister
3699 EDTComponent_swigregister(EDTComponent)
3700
3702 """EDTComponent_Create(char const * name, size_t offset, ExtendedDataType type) -> EDTComponent"""
3703 return _gdal.EDTComponent_Create(*args)
3704
3705 -class Band(MajorObject):
3706 """Proxy of C++ GDALRasterBandShadow class."""
3707
3708 __swig_setmethods__ = {}
3709 for _s in [MajorObject]:
3710 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
3711 __setattr__ = lambda self, name, value: _swig_setattr(self, Band, name, value)
3712 __swig_getmethods__ = {}
3713 for _s in [MajorObject]:
3714 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
3715 __getattr__ = lambda self, name: _swig_getattr(self, Band, name)
3716
3718 raise AttributeError("No constructor defined")
3719 __repr__ = _swig_repr
3720 __swig_getmethods__["XSize"] = _gdal.Band_XSize_get
3721 if _newclass:
3722 XSize = _swig_property(_gdal.Band_XSize_get)
3723 __swig_getmethods__["YSize"] = _gdal.Band_YSize_get
3724 if _newclass:
3725 YSize = _swig_property(_gdal.Band_YSize_get)
3726 __swig_getmethods__["DataType"] = _gdal.Band_DataType_get
3727 if _newclass:
3728 DataType = _swig_property(_gdal.Band_DataType_get)
3729
3731 """GetDataset(Band self) -> Dataset"""
3732 return _gdal.Band_GetDataset(self, *args)
3733
3734
3736 """GetBand(Band self) -> int"""
3737 return _gdal.Band_GetBand(self, *args)
3738
3739
3741 """GetBlockSize(Band self)"""
3742 return _gdal.Band_GetBlockSize(self, *args)
3743
3744
3746 """GetActualBlockSize(Band self, int nXBlockOff, int nYBlockOff)"""
3747 return _gdal.Band_GetActualBlockSize(self, *args)
3748
3749
3751 """GetColorInterpretation(Band self) -> GDALColorInterp"""
3752 return _gdal.Band_GetColorInterpretation(self, *args)
3753
3754
3756 """GetRasterColorInterpretation(Band self) -> GDALColorInterp"""
3757 return _gdal.Band_GetRasterColorInterpretation(self, *args)
3758
3759
3761 """SetColorInterpretation(Band self, GDALColorInterp val) -> CPLErr"""
3762 return _gdal.Band_SetColorInterpretation(self, *args)
3763
3764
3766 """SetRasterColorInterpretation(Band self, GDALColorInterp val) -> CPLErr"""
3767 return _gdal.Band_SetRasterColorInterpretation(self, *args)
3768
3769
3771 """GetNoDataValue(Band self)"""
3772 return _gdal.Band_GetNoDataValue(self, *args)
3773
3774
3776 """SetNoDataValue(Band self, double d) -> CPLErr"""
3777 return _gdal.Band_SetNoDataValue(self, *args)
3778
3779
3781 """DeleteNoDataValue(Band self) -> CPLErr"""
3782 return _gdal.Band_DeleteNoDataValue(self, *args)
3783
3784
3786 """GetUnitType(Band self) -> char const *"""
3787 return _gdal.Band_GetUnitType(self, *args)
3788
3789
3791 """SetUnitType(Band self, char const * val) -> CPLErr"""
3792 return _gdal.Band_SetUnitType(self, *args)
3793
3794
3796 """GetRasterCategoryNames(Band self) -> char **"""
3797 return _gdal.Band_GetRasterCategoryNames(self, *args)
3798
3799
3801 """SetRasterCategoryNames(Band self, char ** names) -> CPLErr"""
3802 return _gdal.Band_SetRasterCategoryNames(self, *args)
3803
3804
3806 """GetMinimum(Band self)"""
3807 return _gdal.Band_GetMinimum(self, *args)
3808
3809
3811 """GetMaximum(Band self)"""
3812 return _gdal.Band_GetMaximum(self, *args)
3813
3814
3816 """GetOffset(Band self)"""
3817 return _gdal.Band_GetOffset(self, *args)
3818
3819
3821 """GetScale(Band self)"""
3822 return _gdal.Band_GetScale(self, *args)
3823
3824
3826 """SetOffset(Band self, double val) -> CPLErr"""
3827 return _gdal.Band_SetOffset(self, *args)
3828
3829
3831 """SetScale(Band self, double val) -> CPLErr"""
3832 return _gdal.Band_SetScale(self, *args)
3833
3834
3836 """GetStatistics(Band self, int approx_ok, int force) -> CPLErr"""
3837 return _gdal.Band_GetStatistics(self, *args)
3838
3839
3841 """ComputeStatistics(Band self, bool approx_ok, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
3842 return _gdal.Band_ComputeStatistics(self, *args)
3843
3844
3846 """SetStatistics(Band self, double min, double max, double mean, double stddev) -> CPLErr"""
3847 return _gdal.Band_SetStatistics(self, *args)
3848
3849
3851 """GetOverviewCount(Band self) -> int"""
3852 return _gdal.Band_GetOverviewCount(self, *args)
3853
3854
3856 """GetOverview(Band self, int i) -> Band"""
3857 return _gdal.Band_GetOverview(self, *args)
3858
3859
3861 """Checksum(Band self, int xoff=0, int yoff=0, int * xsize=None, int * ysize=None) -> int"""
3862 return _gdal.Band_Checksum(self, *args, **kwargs)
3863
3864
3866 """ComputeRasterMinMax(Band self, int approx_ok=0)"""
3867 return _gdal.Band_ComputeRasterMinMax(self, *args)
3868
3869
3871 """ComputeBandStats(Band self, int samplestep=1)"""
3872 return _gdal.Band_ComputeBandStats(self, *args)
3873
3874
3875 - def Fill(self, *args):
3876 """Fill(Band self, double real_fill, double imag_fill=0.0) -> CPLErr"""
3877 return _gdal.Band_Fill(self, *args)
3878
3879
3881 """WriteRaster(Band self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None, int * buf_ysize=None, GDALDataType * buf_type=None, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None) -> CPLErr"""
3882 return _gdal.Band_WriteRaster(self, *args, **kwargs)
3883
3884
3886 """FlushCache(Band self)"""
3887 return _gdal.Band_FlushCache(self, *args)
3888
3889
3891 """GetRasterColorTable(Band self) -> ColorTable"""
3892 return _gdal.Band_GetRasterColorTable(self, *args)
3893
3894
3896 """GetColorTable(Band self) -> ColorTable"""
3897 return _gdal.Band_GetColorTable(self, *args)
3898
3899
3901 """SetRasterColorTable(Band self, ColorTable arg) -> int"""
3902 return _gdal.Band_SetRasterColorTable(self, *args)
3903
3904
3906 """SetColorTable(Band self, ColorTable arg) -> int"""
3907 return _gdal.Band_SetColorTable(self, *args)
3908
3909
3911 """GetDefaultRAT(Band self) -> RasterAttributeTable"""
3912 return _gdal.Band_GetDefaultRAT(self, *args)
3913
3914
3916 """SetDefaultRAT(Band self, RasterAttributeTable table) -> int"""
3917 return _gdal.Band_SetDefaultRAT(self, *args)
3918
3919
3921 """GetMaskBand(Band self) -> Band"""
3922 return _gdal.Band_GetMaskBand(self, *args)
3923
3924
3926 """GetMaskFlags(Band self) -> int"""
3927 return _gdal.Band_GetMaskFlags(self, *args)
3928
3929
3931 """CreateMaskBand(Band self, int nFlags) -> CPLErr"""
3932 return _gdal.Band_CreateMaskBand(self, *args)
3933
3934
3936 """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"""
3937 return _gdal.Band_GetHistogram(self, *args, **kwargs)
3938
3939
3941 """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"""
3942 return _gdal.Band_GetDefaultHistogram(self, *args, **kwargs)
3943
3944
3946 """SetDefaultHistogram(Band self, double min, double max, int buckets_in) -> CPLErr"""
3947 return _gdal.Band_SetDefaultHistogram(self, *args)
3948
3949
3951 """HasArbitraryOverviews(Band self) -> bool"""
3952 return _gdal.Band_HasArbitraryOverviews(self, *args)
3953
3954
3956 """GetCategoryNames(Band self) -> char **"""
3957 return _gdal.Band_GetCategoryNames(self, *args)
3958
3959
3961 """SetCategoryNames(Band self, char ** papszCategoryNames) -> CPLErr"""
3962 return _gdal.Band_SetCategoryNames(self, *args)
3963
3964
3966 """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"""
3967 return _gdal.Band_GetVirtualMem(self, *args, **kwargs)
3968
3969
3971 """GetVirtualMemAuto(Band self, GDALRWFlag eRWFlag, char ** options=None) -> VirtualMem"""
3972 return _gdal.Band_GetVirtualMemAuto(self, *args, **kwargs)
3973
3974
3976 """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"""
3977 return _gdal.Band_GetTiledVirtualMem(self, *args, **kwargs)
3978
3979
3981 """GetDataCoverageStatus(Band self, int nXOff, int nYOff, int nXSize, int nYSize, int nMaskFlagStop=0) -> int"""
3982 return _gdal.Band_GetDataCoverageStatus(self, *args)
3983
3984
3986 """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"""
3987 return _gdal.Band_AdviseRead(self, *args)
3988
3989
3991 """AsMDArray(Band self) -> MDArray"""
3992 return _gdal.Band_AsMDArray(self, *args)
3993
3994
3996 """ReadRaster1(Band self, double xoff, double yoff, double xsize, double ysize, int * buf_xsize=None, int * buf_ysize=None, GDALDataType * buf_type=None, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0, void * callback_data=None, void * inputOutputBuf=None) -> CPLErr"""
3997 return _gdal.Band_ReadRaster1(self, *args, **kwargs)
3998
3999
4001 """ReadBlock(Band self, int xoff, int yoff, void * buf_obj=None) -> CPLErr"""
4002 return _gdal.Band_ReadBlock(self, *args, **kwargs)
4003
4004
4005
4007 """ComputeStatistics(Band self, bool approx_ok, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr"""
4008
4009
4010
4011 approx_ok = args[0]
4012 if approx_ok == 0:
4013 approx_ok = False
4014 elif approx_ok == 1:
4015 approx_ok = True
4016 new_args = [approx_ok]
4017 for arg in args[1:]:
4018 new_args.append( arg )
4019
4020 return _gdal.Band_ComputeStatistics(self, *new_args)
4021
4022
4023 - def ReadRaster(self, xoff=0, yoff=0, xsize=None, ysize=None,
4024 buf_xsize=None, buf_ysize=None, buf_type=None,
4025 buf_pixel_space=None, buf_line_space=None,
4026 resample_alg=gdalconst.GRIORA_NearestNeighbour,
4027 callback=None,
4028 callback_data=None,
4029 buf_obj=None):
4030
4031 if xsize is None:
4032 xsize = self.XSize
4033 if ysize is None:
4034 ysize = self.YSize
4035
4036 return _gdal.Band_ReadRaster1(self, xoff, yoff, xsize, ysize,
4037 buf_xsize, buf_ysize, buf_type,
4038 buf_pixel_space, buf_line_space,
4039 resample_alg, callback, callback_data,
4040 buf_obj)
4041
4042 - def WriteRaster(self, xoff, yoff, xsize, ysize,
4043 buf_string,
4044 buf_xsize=None, buf_ysize=None, buf_type=None,
4045 buf_pixel_space=None, buf_line_space=None ):
4046
4047 if buf_xsize is None:
4048 buf_xsize = xsize
4049 if buf_ysize is None:
4050 buf_ysize = ysize
4051
4052
4053
4054 if type(buf_string).__name__ == 'ndarray' and \
4055 buf_xsize == xsize and buf_ysize == ysize and buf_type is None and \
4056 buf_pixel_space is None and buf_line_space is None:
4057 return self.WriteArray(buf_string, xoff=xoff, yoff=yoff)
4058
4059 if buf_type is None:
4060 buf_type = self.DataType
4061
4062 return _gdal.Band_WriteRaster(self,
4063 xoff, yoff, xsize, ysize,
4064 buf_string, buf_xsize, buf_ysize, buf_type,
4065 buf_pixel_space, buf_line_space )
4066
4067 - def ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None,
4068 buf_xsize=None, buf_ysize=None, buf_type=None, buf_obj=None,
4069 resample_alg=gdalconst.GRIORA_NearestNeighbour,
4070 callback=None,
4071 callback_data=None):
4072 """ Reading a chunk of a GDAL band into a numpy array. The optional (buf_xsize,buf_ysize,buf_type)
4073 parameters should generally not be specified if buf_obj is specified. The array is returned"""
4074
4075 from osgeo import gdal_array
4076
4077 return gdal_array.BandReadAsArray(self, xoff, yoff,
4078 win_xsize, win_ysize,
4079 buf_xsize, buf_ysize, buf_type, buf_obj,
4080 resample_alg=resample_alg,
4081 callback=callback,
4082 callback_data=callback_data)
4083
4094
4095 - def GetVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0,
4096 xsize=None, ysize=None, bufxsize=None, bufysize=None,
4097 datatype=None,
4098 cache_size = 10 * 1024 * 1024, page_size_hint = 0,
4099 options=None):
4100 """Return a NumPy array for the band, seen as a virtual memory mapping.
4101 An element is accessed with array[y][x].
4102 Any reference to the array must be dropped before the last reference to the
4103 related dataset is also dropped.
4104 """
4105 from osgeo import gdal_array
4106 if xsize is None:
4107 xsize = self.XSize
4108 if ysize is None:
4109 ysize = self.YSize
4110 if bufxsize is None:
4111 bufxsize = self.XSize
4112 if bufysize is None:
4113 bufysize = self.YSize
4114 if datatype is None:
4115 datatype = self.DataType
4116 if options is None:
4117 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, cache_size, page_size_hint)
4118 else:
4119 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, cache_size, page_size_hint, options)
4120 return gdal_array.VirtualMemGetArray(virtualmem)
4121
4123 """Return a NumPy array for the band, seen as a virtual memory mapping.
4124 An element is accessed with array[y][x].
4125 Any reference to the array must be dropped before the last reference to the
4126 related dataset is also dropped.
4127 """
4128 from osgeo import gdal_array
4129 if options is None:
4130 virtualmem = self.GetVirtualMemAuto(eAccess)
4131 else:
4132 virtualmem = self.GetVirtualMemAuto(eAccess,options)
4133 return gdal_array.VirtualMemGetArray( virtualmem )
4134
4135 - def GetTiledVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0,
4136 xsize=None, ysize=None, tilexsize=256, tileysize=256,
4137 datatype=None,
4138 cache_size = 10 * 1024 * 1024, options=None):
4139 """Return a NumPy array for the band, seen as a virtual memory mapping with
4140 a tile organization.
4141 An element is accessed with array[tiley][tilex][y][x].
4142 Any reference to the array must be dropped before the last reference to the
4143 related dataset is also dropped.
4144 """
4145 from osgeo import gdal_array
4146 if xsize is None:
4147 xsize = self.XSize
4148 if ysize is None:
4149 ysize = self.YSize
4150 if datatype is None:
4151 datatype = self.DataType
4152 if options is None:
4153 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,cache_size)
4154 else:
4155 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,cache_size,options)
4156 return gdal_array.VirtualMemGetArray( virtualmem )
4157
4158 Band_swigregister = _gdal.Band_swigregister
4159 Band_swigregister(Band)
4160
4162 """Proxy of C++ GDALColorTableShadow class."""
4163
4164 __swig_setmethods__ = {}
4165 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorTable, name, value)
4166 __swig_getmethods__ = {}
4167 __getattr__ = lambda self, name: _swig_getattr(self, ColorTable, name)
4168 __repr__ = _swig_repr
4169
4171 """__init__(GDALColorTableShadow self, GDALPaletteInterp palette) -> ColorTable"""
4172 this = _gdal.new_ColorTable(*args, **kwargs)
4173 try:
4174 self.this.append(this)
4175 except __builtin__.Exception:
4176 self.this = this
4177 __swig_destroy__ = _gdal.delete_ColorTable
4178 __del__ = lambda self: None
4179
4180 - def Clone(self, *args):
4181 """Clone(ColorTable self) -> ColorTable"""
4182 return _gdal.ColorTable_Clone(self, *args)
4183
4184
4186 """GetPaletteInterpretation(ColorTable self) -> GDALPaletteInterp"""
4187 return _gdal.ColorTable_GetPaletteInterpretation(self, *args)
4188
4189
4191 """GetCount(ColorTable self) -> int"""
4192 return _gdal.ColorTable_GetCount(self, *args)
4193
4194
4195 - def GetColorEntry(self, *args):
4196 """GetColorEntry(ColorTable self, int entry) -> ColorEntry"""
4197 return _gdal.ColorTable_GetColorEntry(self, *args)
4198
4199
4200 - def GetColorEntryAsRGB(self, *args):
4201 """GetColorEntryAsRGB(ColorTable self, int entry, ColorEntry centry) -> int"""
4202 return _gdal.ColorTable_GetColorEntryAsRGB(self, *args)
4203
4204
4205 - def SetColorEntry(self, *args):
4206 """SetColorEntry(ColorTable self, int entry, ColorEntry centry)"""
4207 return _gdal.ColorTable_SetColorEntry(self, *args)
4208
4209
4211 """CreateColorRamp(ColorTable self, int nStartIndex, ColorEntry startcolor, int nEndIndex, ColorEntry endcolor)"""
4212 return _gdal.ColorTable_CreateColorRamp(self, *args)
4213
4214 ColorTable_swigregister = _gdal.ColorTable_swigregister
4215 ColorTable_swigregister(ColorTable)
4216
4218 """Proxy of C++ GDALRasterAttributeTableShadow class."""
4219
4220 __swig_setmethods__ = {}
4221 __setattr__ = lambda self, name, value: _swig_setattr(self, RasterAttributeTable, name, value)
4222 __swig_getmethods__ = {}
4223 __getattr__ = lambda self, name: _swig_getattr(self, RasterAttributeTable, name)
4224 __repr__ = _swig_repr
4225
4227 """__init__(GDALRasterAttributeTableShadow self) -> RasterAttributeTable"""
4228 this = _gdal.new_RasterAttributeTable(*args)
4229 try:
4230 self.this.append(this)
4231 except __builtin__.Exception:
4232 self.this = this
4233 __swig_destroy__ = _gdal.delete_RasterAttributeTable
4234 __del__ = lambda self: None
4235
4236 - def Clone(self, *args):
4237 """Clone(RasterAttributeTable self) -> RasterAttributeTable"""
4238 return _gdal.RasterAttributeTable_Clone(self, *args)
4239
4240
4242 """GetColumnCount(RasterAttributeTable self) -> int"""
4243 return _gdal.RasterAttributeTable_GetColumnCount(self, *args)
4244
4245
4247 """GetNameOfCol(RasterAttributeTable self, int iCol) -> char const *"""
4248 return _gdal.RasterAttributeTable_GetNameOfCol(self, *args)
4249
4250
4252 """GetUsageOfCol(RasterAttributeTable self, int iCol) -> GDALRATFieldUsage"""
4253 return _gdal.RasterAttributeTable_GetUsageOfCol(self, *args)
4254
4255
4257 """GetTypeOfCol(RasterAttributeTable self, int iCol) -> GDALRATFieldType"""
4258 return _gdal.RasterAttributeTable_GetTypeOfCol(self, *args)
4259
4260
4262 """GetColOfUsage(RasterAttributeTable self, GDALRATFieldUsage eUsage) -> int"""
4263 return _gdal.RasterAttributeTable_GetColOfUsage(self, *args)
4264
4265
4267 """GetRowCount(RasterAttributeTable self) -> int"""
4268 return _gdal.RasterAttributeTable_GetRowCount(self, *args)
4269
4270
4272 """GetValueAsString(RasterAttributeTable self, int iRow, int iCol) -> char const *"""
4273 return _gdal.RasterAttributeTable_GetValueAsString(self, *args)
4274
4275
4277 """GetValueAsInt(RasterAttributeTable self, int iRow, int iCol) -> int"""
4278 return _gdal.RasterAttributeTable_GetValueAsInt(self, *args)
4279
4280
4282 """GetValueAsDouble(RasterAttributeTable self, int iRow, int iCol) -> double"""
4283 return _gdal.RasterAttributeTable_GetValueAsDouble(self, *args)
4284
4285
4287 """SetValueAsString(RasterAttributeTable self, int iRow, int iCol, char const * pszValue)"""
4288 return _gdal.RasterAttributeTable_SetValueAsString(self, *args)
4289
4290
4292 """SetValueAsInt(RasterAttributeTable self, int iRow, int iCol, int nValue)"""
4293 return _gdal.RasterAttributeTable_SetValueAsInt(self, *args)
4294
4295
4297 """SetValueAsDouble(RasterAttributeTable self, int iRow, int iCol, double dfValue)"""
4298 return _gdal.RasterAttributeTable_SetValueAsDouble(self, *args)
4299
4300
4302 """SetRowCount(RasterAttributeTable self, int nCount)"""
4303 return _gdal.RasterAttributeTable_SetRowCount(self, *args)
4304
4305
4307 """CreateColumn(RasterAttributeTable self, char const * pszName, GDALRATFieldType eType, GDALRATFieldUsage eUsage) -> int"""
4308 return _gdal.RasterAttributeTable_CreateColumn(self, *args)
4309
4310
4312 """GetLinearBinning(RasterAttributeTable self) -> bool"""
4313 return _gdal.RasterAttributeTable_GetLinearBinning(self, *args)
4314
4315
4317 """SetLinearBinning(RasterAttributeTable self, double dfRow0Min, double dfBinSize) -> int"""
4318 return _gdal.RasterAttributeTable_SetLinearBinning(self, *args)
4319
4320
4322 """GetRowOfValue(RasterAttributeTable self, double dfValue) -> int"""
4323 return _gdal.RasterAttributeTable_GetRowOfValue(self, *args)
4324
4325
4327 """ChangesAreWrittenToFile(RasterAttributeTable self) -> int"""
4328 return _gdal.RasterAttributeTable_ChangesAreWrittenToFile(self, *args)
4329
4330
4332 """DumpReadable(RasterAttributeTable self)"""
4333 return _gdal.RasterAttributeTable_DumpReadable(self, *args)
4334
4335
4337 """SetTableType(RasterAttributeTable self, GDALRATTableType eTableType)"""
4338 return _gdal.RasterAttributeTable_SetTableType(self, *args)
4339
4340
4342 """GetTableType(RasterAttributeTable self) -> GDALRATTableType"""
4343 return _gdal.RasterAttributeTable_GetTableType(self, *args)
4344
4345
4350
4355
4356 RasterAttributeTable_swigregister = _gdal.RasterAttributeTable_swigregister
4357 RasterAttributeTable_swigregister(RasterAttributeTable)
4358
4359
4361 """TermProgress_nocb(double dfProgress, char const * pszMessage=None, void * pData=None) -> int"""
4362 return _gdal.TermProgress_nocb(*args, **kwargs)
4363 TermProgress = _gdal.TermProgress
4364
4368
4370 """DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4371 return _gdal.DitherRGB2PCT(*args, **kwargs)
4372
4374 """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"""
4375 return _gdal.ReprojectImage(*args, **kwargs)
4376
4378 """ComputeProximity(Band srcBand, Band proximityBand, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4379 return _gdal.ComputeProximity(*args, **kwargs)
4380
4382 """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"""
4383 return _gdal.RasterizeLayer(*args, **kwargs)
4384
4386 """Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4387 return _gdal.Polygonize(*args, **kwargs)
4388
4390 """FPolygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4391 return _gdal.FPolygonize(*args, **kwargs)
4392
4394 """FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4395 return _gdal.FillNodata(*args, **kwargs)
4396
4398 """SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness=4, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4399 return _gdal.SieveFilter(*args, **kwargs)
4400
4402 """RegenerateOverviews(Band srcBand, int overviewBandCount, char const * resampling, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4403 return _gdal.RegenerateOverviews(*args, **kwargs)
4404
4406 """RegenerateOverview(Band srcBand, Band overviewBand, char const * resampling, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4407 return _gdal.RegenerateOverview(*args, **kwargs)
4408
4410 """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"""
4411 return _gdal.ContourGenerate(*args, **kwargs)
4412
4414 """ContourGenerateEx(Band srcBand, Layer dstLayer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4415 return _gdal.ContourGenerateEx(*args, **kwargs)
4416 GVM_Diagonal = _gdal.GVM_Diagonal
4417 GVM_Edge = _gdal.GVM_Edge
4418 GVM_Max = _gdal.GVM_Max
4419 GVM_Min = _gdal.GVM_Min
4420 GVOT_NORMAL = _gdal.GVOT_NORMAL
4421 GVOT_MIN_TARGET_HEIGHT_FROM_DEM = _gdal.GVOT_MIN_TARGET_HEIGHT_FROM_DEM
4422 GVOT_MIN_TARGET_HEIGHT_FROM_GROUND = _gdal.GVOT_MIN_TARGET_HEIGHT_FROM_GROUND
4423
4425 """ViewshedGenerate(Band srcBand, char const * driverName, char const * targetRasterName, char ** creationOptions, double observerX, double observerY, double observerHeight, double targetHeight, double visibleVal, double invisibleVal, double outOfRangeVal, double noDataVal, double dfCurvCoeff, GDALViewshedMode mode, double maxDistance, GDALProgressFunc callback=0, void * callback_data=None, GDALViewshedOutputType heightMode=GVOT_NORMAL, char ** papszOptions=None) -> Dataset"""
4426 return _gdal.ViewshedGenerate(*args, **kwargs)
4427
4429 """AutoCreateWarpedVRT(Dataset src_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg, double maxerror=0.0) -> Dataset"""
4430 return _gdal.AutoCreateWarpedVRT(*args)
4431
4433 """CreatePansharpenedVRT(char const * pszXML, Band panchroBand, int nInputSpectralBands) -> Dataset"""
4434 return _gdal.CreatePansharpenedVRT(*args)
4465
4466 GDALTransformerInfoShadow_swigregister = _gdal.GDALTransformerInfoShadow_swigregister
4467 GDALTransformerInfoShadow_swigregister(GDALTransformerInfoShadow)
4468
4469
4473
4475 """_ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) -> Dataset"""
4476 return _gdal._ApplyVerticalShiftGrid(*args, **kwargs)
4477
4481
4485
4487 """VersionInfo(char const * request) -> char const *"""
4488 return _gdal.VersionInfo(*args)
4489
4493
4497
4501
4505
4509
4513
4517
4519 """GetDataTypeName(GDALDataType eDataType) -> char const *"""
4520 return _gdal.GetDataTypeName(*args)
4521
4523 """GetDataTypeByName(char const * pszDataTypeName) -> GDALDataType"""
4524 return _gdal.GetDataTypeByName(*args)
4525
4529
4533
4535 """DecToDMS(double arg1, char const * arg2, int arg3=2) -> char const *"""
4536 return _gdal.DecToDMS(*args)
4537
4541
4545
4547 """ParseXMLString(char * pszXMLString) -> CPLXMLNode *"""
4548 return _gdal.ParseXMLString(*args)
4549
4551 """SerializeXMLTree(CPLXMLNode * xmlnode) -> retStringAndCPLFree *"""
4552 return _gdal.SerializeXMLTree(*args)
4553
4555 """GetJPEG2000Structure(char const * pszFilename, char ** options=None) -> CPLXMLNode *"""
4556 return _gdal.GetJPEG2000Structure(*args)
4557
4559 """GetJPEG2000StructureAsString(char const * pszFilename, char ** options=None) -> retStringAndCPLFree *"""
4560 return _gdal.GetJPEG2000StructureAsString(*args)
4561
4565
4569
4571 """GetDriver(int i) -> Driver"""
4572 return _gdal.GetDriver(*args)
4573
4575 """Open(char const * utf8_path, GDALAccess eAccess) -> Dataset"""
4576 return _gdal.Open(*args)
4577
4579 """OpenEx(char const * utf8_path, unsigned int nOpenFlags=0, char ** allowed_drivers=None, char ** open_options=None, char ** sibling_files=None) -> Dataset"""
4580 return _gdal.OpenEx(*args, **kwargs)
4581
4583 """OpenShared(char const * utf8_path, GDALAccess eAccess) -> Dataset"""
4584 return _gdal.OpenShared(*args)
4585
4587 """IdentifyDriver(char const * utf8_path, char ** papszSiblings=None) -> Driver"""
4588 return _gdal.IdentifyDriver(*args)
4589
4591 """IdentifyDriverEx(char const * utf8_path, unsigned int nIdentifyFlags=0, char ** allowed_drivers=None, char ** sibling_files=None) -> Driver"""
4592 return _gdal.IdentifyDriverEx(*args, **kwargs)
4593
4597
4598 __version__ = _gdal.VersionInfo("RELEASE_NAME")
4599
4618 GDALInfoOptions_swigregister = _gdal.GDALInfoOptions_swigregister
4619 GDALInfoOptions_swigregister(GDALInfoOptions)
4620
4621
4623 """InfoInternal(Dataset hDataset, GDALInfoOptions infoOptions) -> retStringAndCPLFree *"""
4624 return _gdal.InfoInternal(*args)
4643 GDALMultiDimInfoOptions_swigregister = _gdal.GDALMultiDimInfoOptions_swigregister
4644 GDALMultiDimInfoOptions_swigregister(GDALMultiDimInfoOptions)
4645
4646
4648 """MultiDimInfoInternal(Dataset hDataset, GDALMultiDimInfoOptions infoOptions) -> retStringAndCPLFree *"""
4649 return _gdal.MultiDimInfoInternal(*args)
4668 GDALTranslateOptions_swigregister = _gdal.GDALTranslateOptions_swigregister
4669 GDALTranslateOptions_swigregister(GDALTranslateOptions)
4670
4671
4673 """TranslateInternal(char const * dest, Dataset dataset, GDALTranslateOptions translateOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4674 return _gdal.TranslateInternal(*args)
4693 GDALWarpAppOptions_swigregister = _gdal.GDALWarpAppOptions_swigregister
4694 GDALWarpAppOptions_swigregister(GDALWarpAppOptions)
4695
4696
4698 """wrapper_GDALWarpDestDS(Dataset dstDS, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4699 return _gdal.wrapper_GDALWarpDestDS(*args)
4700
4702 """wrapper_GDALWarpDestName(char const * dest, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4703 return _gdal.wrapper_GDALWarpDestName(*args)
4722 GDALVectorTranslateOptions_swigregister = _gdal.GDALVectorTranslateOptions_swigregister
4723 GDALVectorTranslateOptions_swigregister(GDALVectorTranslateOptions)
4724
4725
4727 """wrapper_GDALVectorTranslateDestDS(Dataset dstDS, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4728 return _gdal.wrapper_GDALVectorTranslateDestDS(*args)
4729
4731 """wrapper_GDALVectorTranslateDestName(char const * dest, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4732 return _gdal.wrapper_GDALVectorTranslateDestName(*args)
4751 GDALDEMProcessingOptions_swigregister = _gdal.GDALDEMProcessingOptions_swigregister
4752 GDALDEMProcessingOptions_swigregister(GDALDEMProcessingOptions)
4753
4754
4756 """DEMProcessingInternal(char const * dest, Dataset dataset, char const * pszProcessing, char const * pszColorFilename, GDALDEMProcessingOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4757 return _gdal.DEMProcessingInternal(*args)
4776 GDALNearblackOptions_swigregister = _gdal.GDALNearblackOptions_swigregister
4777 GDALNearblackOptions_swigregister(GDALNearblackOptions)
4778
4779
4781 """wrapper_GDALNearblackDestDS(Dataset dstDS, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4782 return _gdal.wrapper_GDALNearblackDestDS(*args)
4783
4785 """wrapper_GDALNearblackDestName(char const * dest, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4786 return _gdal.wrapper_GDALNearblackDestName(*args)
4805 GDALGridOptions_swigregister = _gdal.GDALGridOptions_swigregister
4806 GDALGridOptions_swigregister(GDALGridOptions)
4807
4808
4810 """GridInternal(char const * dest, Dataset dataset, GDALGridOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4811 return _gdal.GridInternal(*args)
4830 GDALRasterizeOptions_swigregister = _gdal.GDALRasterizeOptions_swigregister
4831 GDALRasterizeOptions_swigregister(GDALRasterizeOptions)
4832
4833
4835 """wrapper_GDALRasterizeDestDS(Dataset dstDS, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
4836 return _gdal.wrapper_GDALRasterizeDestDS(*args)
4837
4839 """wrapper_GDALRasterizeDestName(char const * dest, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4840 return _gdal.wrapper_GDALRasterizeDestName(*args)
4859 GDALBuildVRTOptions_swigregister = _gdal.GDALBuildVRTOptions_swigregister
4860 GDALBuildVRTOptions_swigregister(GDALBuildVRTOptions)
4861
4862
4864 """BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4865 return _gdal.BuildVRTInternalObjects(*args)
4866
4868 """BuildVRTInternalNames(char const * dest, char ** source_filenames, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4869 return _gdal.BuildVRTInternalNames(*args)
4888 GDALMultiDimTranslateOptions_swigregister = _gdal.GDALMultiDimTranslateOptions_swigregister
4889 GDALMultiDimTranslateOptions_swigregister(GDALMultiDimTranslateOptions)
4890
4891
4893 """wrapper_GDALMultiDimTranslateDestName(char const * dest, int object_list_count, GDALMultiDimTranslateOptions multiDimTranslateOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset"""
4894 return _gdal.wrapper_GDALMultiDimTranslateDestName(*args)
4895
4896