Package osgeo :: Module gdal
[hide private]
[frames] | no frames]

Source Code for Module osgeo.gdal

   1  # This file was automatically generated by SWIG (http://www.swig.org). 
   2  # Version 3.0.12 
   3  # 
   4  # Do not make changes to this file unless you know what you are doing--modify 
   5  # the SWIG interface file instead. 
   6   
   7  from sys import version_info as _swig_python_version_info 
   8  if _swig_python_version_info >= (2, 7, 0): 
9 - def swig_import_helper():
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):
20 - def swig_import_helper():
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 # Python < 2.2 doesn't have 'property'. 45 46 try: 47 import builtins as __builtin__ 48 except ImportError: 49 import __builtin__ 50
51 -def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
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
70 -def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
72 73
74 -def _swig_getattr(self, class_type, name):
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
83 -def _swig_repr(self):
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:
94 - class _object:
95 pass
96 _newclass = 0 97 98 99 100 101 have_warned = 0
102 -def deprecation_warn(module, sub_package=None, new_module=None):
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
138 -def RGBFile2PCTFile( src_filename, dst_filename ):
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
187 -def GetUseExceptions(*args):
188 """GetUseExceptions() -> int""" 189 return _gdal.GetUseExceptions(*args)
190
191 -def UseExceptions(*args):
192 """UseExceptions()""" 193 return _gdal.UseExceptions(*args)
194
195 -def DontUseExceptions(*args):
196 """DontUseExceptions()""" 197 return _gdal.DontUseExceptions(*args)
198
199 -def VSIFReadL(*args):
200 """VSIFReadL(unsigned int nMembSize, unsigned int nMembCount, VSILFILE fp) -> unsigned int""" 201 return _gdal.VSIFReadL(*args)
202
203 -def VSIGetMemFileBuffer_unsafe(*args):
204 """VSIGetMemFileBuffer_unsafe(char const * utf8_path)""" 205 return _gdal.VSIGetMemFileBuffer_unsafe(*args)
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
307 -def MultiDimInfo(ds, **kwargs):
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
329 -def _strHighPrec(x):
330 return ('%.18g' % x) if isinstance(x, float) else str(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, xmp = 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 xmp --- whether to copy XMP metadata 386 resampleAlg --- resampling mode 387 callback --- callback method 388 callback_data --- user data for callback 389 """ 390 391 # Only used for tests 392 return_option_list = options == '__RETURN_OPTION_LIST__' 393 if return_option_list: 394 options = [] 395 else: 396 options = [] if options is None else options 397 398 if isinstance(options, str): 399 new_options = ParseCommandLine(options) 400 else: 401 new_options = options 402 if format is not None: 403 new_options += ['-of', format] 404 if outputType != gdalconst.GDT_Unknown: 405 new_options += ['-ot', GetDataTypeName(outputType)] 406 if maskBand != None: 407 new_options += ['-mask', str(maskBand)] 408 if bandList != None: 409 for b in bandList: 410 new_options += ['-b', str(b)] 411 if width != 0 or height != 0: 412 new_options += ['-outsize', str(width), str(height)] 413 elif widthPct != 0 and heightPct != 0: 414 new_options += ['-outsize', str(widthPct) + '%%', str(heightPct) + '%%'] 415 if creationOptions is not None: 416 if isinstance(creationOptions, str): 417 new_options += ['-co', creationOptions] 418 else: 419 for opt in creationOptions: 420 new_options += ['-co', opt] 421 if srcWin is not None: 422 new_options += ['-srcwin', _strHighPrec(srcWin[0]), _strHighPrec(srcWin[1]), _strHighPrec(srcWin[2]), _strHighPrec(srcWin[3])] 423 if strict: 424 new_options += ['-strict'] 425 if unscale: 426 new_options += ['-unscale'] 427 if scaleParams: 428 for scaleParam in scaleParams: 429 new_options += ['-scale'] 430 for v in scaleParam: 431 new_options += [str(v)] 432 if exponents: 433 for exponent in exponents: 434 new_options += ['-exponent', _strHighPrec(exponent)] 435 if outputBounds is not None: 436 new_options += ['-a_ullr', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 437 if metadataOptions is not None: 438 if isinstance(metadataOptions, str): 439 new_options += ['-mo', metadataOptions] 440 else: 441 for opt in metadataOptions: 442 new_options += ['-mo', opt] 443 if outputSRS is not None: 444 new_options += ['-a_srs', str(outputSRS)] 445 if nogcp: 446 new_options += ['-nogcp'] 447 if GCPs is not None: 448 for gcp in GCPs: 449 new_options += ['-gcp', _strHighPrec(gcp.GCPPixel), _strHighPrec(gcp.GCPLine), _strHighPrec(gcp.GCPX), str(gcp.GCPY), _strHighPrec(gcp.GCPZ)] 450 if projWin is not None: 451 new_options += ['-projwin', _strHighPrec(projWin[0]), _strHighPrec(projWin[1]), _strHighPrec(projWin[2]), _strHighPrec(projWin[3])] 452 if projWinSRS is not None: 453 new_options += ['-projwin_srs', str(projWinSRS)] 454 if noData is not None: 455 new_options += ['-a_nodata', _strHighPrec(noData)] 456 if rgbExpand is not None: 457 new_options += ['-expand', str(rgbExpand)] 458 if stats: 459 new_options += ['-stats'] 460 if not rat: 461 new_options += ['-norat'] 462 if not xmp: 463 new_options += ['-noxmp'] 464 if resampleAlg is not None: 465 if resampleAlg in mapGRIORAMethodToString: 466 new_options += ['-r', mapGRIORAMethodToString[resampleAlg]] 467 else: 468 new_options += ['-r', str(resampleAlg)] 469 if xRes != 0 and yRes != 0: 470 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 471 472 if return_option_list: 473 return new_options 474 475 return (GDALTranslateOptions(new_options), callback, callback_data)
476
477 -def Translate(destName, srcDS, **kwargs):
478 """ Convert a dataset. 479 Arguments are : 480 destName --- Output dataset name 481 srcDS --- a Dataset object or a filename 482 Keyword arguments are : 483 options --- return of gdal.TranslateOptions(), string or array of strings 484 other keywords arguments of gdal.TranslateOptions() 485 If options is provided as a gdal.TranslateOptions() object, other keywords are ignored. """ 486 487 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 488 (opts, callback, callback_data) = TranslateOptions(**kwargs) 489 else: 490 (opts, callback, callback_data) = kwargs['options'] 491 if isinstance(srcDS, str): 492 srcDS = Open(srcDS) 493 494 return TranslateInternal(destName, srcDS, opts, callback, callback_data)
495
496 -def WarpOptions(options=None, format=None, 497 outputBounds=None, 498 outputBoundsSRS=None, 499 xRes=None, yRes=None, targetAlignedPixels = False, 500 width = 0, height = 0, 501 srcSRS=None, dstSRS=None, 502 coordinateOperation=None, 503 srcAlpha = False, dstAlpha = False, 504 warpOptions=None, errorThreshold=None, 505 warpMemoryLimit=None, creationOptions=None, outputType = gdalconst.GDT_Unknown, 506 workingType = gdalconst.GDT_Unknown, resampleAlg=None, 507 srcNodata=None, dstNodata=None, multithread = False, 508 tps = False, rpc = False, geoloc = False, polynomialOrder=None, 509 transformerOptions=None, cutlineDSName=None, 510 cutlineLayer=None, cutlineWhere=None, cutlineSQL=None, cutlineBlend=None, cropToCutline = False, 511 copyMetadata = True, metadataConflictValue=None, 512 setColorInterpretation = False, 513 overviewLevel = 'AUTO', 514 callback=None, callback_data=None):
515 """ Create a WarpOptions() object that can be passed to gdal.Warp() 516 Keyword arguments are : 517 options --- can be be an array of strings, a string or let empty and filled from other keywords. 518 format --- output format ("GTiff", etc...) 519 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS 520 outputBoundsSRS --- SRS in which output bounds are expressed, in the case they are not expressed in dstSRS 521 xRes, yRes --- output resolution in target SRS 522 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution 523 width --- width of the output raster in pixel 524 height --- height of the output raster in pixel 525 srcSRS --- source SRS 526 dstSRS --- output SRS 527 coordinateOperation -- coordinate operation as a PROJ string or WKT string 528 srcAlpha --- whether to force the last band of the input dataset to be considered as an alpha band 529 dstAlpha --- whether to force the creation of an output alpha band 530 outputType --- output type (gdalconst.GDT_Byte, etc...) 531 workingType --- working type (gdalconst.GDT_Byte, etc...) 532 warpOptions --- list of warping options 533 errorThreshold --- error threshold for approximation transformer (in pixels) 534 warpMemoryLimit --- size of working buffer in MB 535 resampleAlg --- resampling mode 536 creationOptions --- list of creation options 537 srcNodata --- source nodata value(s) 538 dstNodata --- output nodata value(s) 539 multithread --- whether to multithread computation and I/O operations 540 tps --- whether to use Thin Plate Spline GCP transformer 541 rpc --- whether to use RPC transformer 542 geoloc --- whether to use GeoLocation array transformer 543 polynomialOrder --- order of polynomial GCP interpolation 544 transformerOptions --- list of transformer options 545 cutlineDSName --- cutline dataset name 546 cutlineLayer --- cutline layer name 547 cutlineWhere --- cutline WHERE clause 548 cutlineSQL --- cutline SQL statement 549 cutlineBlend --- cutline blend distance in pixels 550 cropToCutline --- whether to use cutline extent for output bounds 551 copyMetadata --- whether to copy source metadata 552 metadataConflictValue --- metadata data conflict value 553 setColorInterpretation --- whether to force color interpretation of input bands to output bands 554 overviewLevel --- To specify which overview level of source files must be used 555 callback --- callback method 556 callback_data --- user data for callback 557 """ 558 559 # Only used for tests 560 return_option_list = options == '__RETURN_OPTION_LIST__' 561 if return_option_list: 562 options = [] 563 else: 564 options = [] if options is None else options 565 566 if isinstance(options, str): 567 new_options = ParseCommandLine(options) 568 else: 569 new_options = options 570 if format is not None: 571 new_options += ['-of', format] 572 if outputType != gdalconst.GDT_Unknown: 573 new_options += ['-ot', GetDataTypeName(outputType)] 574 if workingType != gdalconst.GDT_Unknown: 575 new_options += ['-wt', GetDataTypeName(workingType)] 576 if outputBounds is not None: 577 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 578 if outputBoundsSRS is not None: 579 new_options += ['-te_srs', str(outputBoundsSRS)] 580 if xRes is not None and yRes is not None: 581 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 582 if width != 0 or height != 0: 583 new_options += ['-ts', str(width), str(height)] 584 if srcSRS is not None: 585 new_options += ['-s_srs', str(srcSRS)] 586 if dstSRS is not None: 587 new_options += ['-t_srs', str(dstSRS)] 588 if coordinateOperation is not None: 589 new_options += ['-ct', coordinateOperation] 590 if targetAlignedPixels: 591 new_options += ['-tap'] 592 if srcAlpha: 593 new_options += ['-srcalpha'] 594 if dstAlpha: 595 new_options += ['-dstalpha'] 596 if warpOptions is not None: 597 for opt in warpOptions: 598 new_options += ['-wo', str(opt)] 599 if errorThreshold is not None: 600 new_options += ['-et', _strHighPrec(errorThreshold)] 601 if resampleAlg is not None: 602 603 mapMethodToString = { 604 gdalconst.GRA_NearestNeighbour: 'near', 605 gdalconst.GRA_Bilinear: 'bilinear', 606 gdalconst.GRA_Cubic: 'cubic', 607 gdalconst.GRA_CubicSpline: 'cubicspline', 608 gdalconst.GRA_Lanczos: 'lanczos', 609 gdalconst.GRA_Average: 'average', 610 gdalconst.GRA_RMS: 'rms', 611 gdalconst.GRA_Mode: 'mode', 612 gdalconst.GRA_Max: 'max', 613 gdalconst.GRA_Min: 'min', 614 gdalconst.GRA_Med: 'med', 615 gdalconst.GRA_Q1: 'q1', 616 gdalconst.GRA_Q3: 'q3', 617 gdalconst.GRA_Sum: 'sum', 618 } 619 620 if resampleAlg in mapMethodToString: 621 new_options += ['-r', mapMethodToString[resampleAlg]] 622 else: 623 new_options += ['-r', str(resampleAlg)] 624 if warpMemoryLimit is not None: 625 new_options += ['-wm', str(warpMemoryLimit)] 626 if creationOptions is not None: 627 for opt in creationOptions: 628 new_options += ['-co', opt] 629 if srcNodata is not None: 630 new_options += ['-srcnodata', str(srcNodata)] 631 if dstNodata is not None: 632 new_options += ['-dstnodata', str(dstNodata)] 633 if multithread: 634 new_options += ['-multi'] 635 if tps: 636 new_options += ['-tps'] 637 if rpc: 638 new_options += ['-rpc'] 639 if geoloc: 640 new_options += ['-geoloc'] 641 if polynomialOrder is not None: 642 new_options += ['-order', str(polynomialOrder)] 643 if transformerOptions is not None: 644 for opt in transformerOptions: 645 new_options += ['-to', opt] 646 if cutlineDSName is not None: 647 new_options += ['-cutline', str(cutlineDSName)] 648 if cutlineLayer is not None: 649 new_options += ['-cl', str(cutlineLayer)] 650 if cutlineWhere is not None: 651 new_options += ['-cwhere', str(cutlineWhere)] 652 if cutlineSQL is not None: 653 new_options += ['-csql', str(cutlineSQL)] 654 if cutlineBlend is not None: 655 new_options += ['-cblend', str(cutlineBlend)] 656 if cropToCutline: 657 new_options += ['-crop_to_cutline'] 658 if not copyMetadata: 659 new_options += ['-nomd'] 660 if metadataConflictValue: 661 new_options += ['-cvmd', str(metadataConflictValue)] 662 if setColorInterpretation: 663 new_options += ['-setci'] 664 665 if overviewLevel is None or isinstance(overviewLevel, str): 666 pass 667 elif isinstance(overviewLevel, int): 668 if overviewLevel < 0: 669 overviewLevel = 'AUTO' + str(overviewLevel) 670 else: 671 overviewLevel = str(overviewLevel) 672 else: 673 overviewLevel = None 674 675 if overviewLevel is not None and overviewLevel != 'AUTO': 676 new_options += ['-ovr', overviewLevel] 677 678 if return_option_list: 679 return new_options 680 681 return (GDALWarpAppOptions(new_options), callback, callback_data)
682
683 -def Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs):
684 """ Warp one or several datasets. 685 Arguments are : 686 destNameOrDestDS --- Output dataset name or object 687 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename 688 Keyword arguments are : 689 options --- return of gdal.WarpOptions(), string or array of strings 690 other keywords arguments of gdal.WarpOptions() 691 If options is provided as a gdal.WarpOptions() object, other keywords are ignored. """ 692 693 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 694 (opts, callback, callback_data) = WarpOptions(**kwargs) 695 else: 696 (opts, callback, callback_data) = kwargs['options'] 697 if isinstance(srcDSOrSrcDSTab, str): 698 srcDSTab = [Open(srcDSOrSrcDSTab)] 699 elif isinstance(srcDSOrSrcDSTab, list): 700 srcDSTab = [] 701 for elt in srcDSOrSrcDSTab: 702 if isinstance(elt, str): 703 srcDSTab.append(Open(elt)) 704 else: 705 srcDSTab.append(elt) 706 else: 707 srcDSTab = [srcDSOrSrcDSTab] 708 709 if isinstance(destNameOrDestDS, str): 710 return wrapper_GDALWarpDestName(destNameOrDestDS, srcDSTab, opts, callback, callback_data) 711 else: 712 return wrapper_GDALWarpDestDS(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
713 714
715 -def VectorTranslateOptions(options=None, format=None, 716 accessMode=None, 717 srcSRS=None, dstSRS=None, reproject=True, 718 coordinateOperation=None, 719 SQLStatement=None, SQLDialect=None, where=None, selectFields=None, 720 addFields=False, 721 forceNullable=False, 722 emptyStrAsNull=False, 723 spatFilter=None, spatSRS=None, 724 datasetCreationOptions=None, 725 layerCreationOptions=None, 726 layers=None, 727 layerName=None, 728 geometryType=None, 729 dim=None, 730 segmentizeMaxDist= None, 731 makeValid=False, 732 zField=None, 733 resolveDomains=False, 734 skipFailures=False, 735 limit=None, 736 callback=None, callback_data=None):
737 """ Create a VectorTranslateOptions() object that can be passed to gdal.VectorTranslate() 738 Keyword arguments are : 739 options --- can be be an array of strings, a string or let empty and filled from other keywords. 740 format --- output format ("ESRI Shapefile", etc...) 741 accessMode --- None for creation, 'update', 'append', 'overwrite' 742 srcSRS --- source SRS 743 dstSRS --- output SRS (with reprojection if reproject = True) 744 coordinateOperation -- coordinate operation as a PROJ string or WKT string 745 reproject --- whether to do reprojection 746 SQLStatement --- SQL statement to apply to the source dataset 747 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...) 748 where --- WHERE clause to apply to source layer(s) 749 selectFields --- list of fields to select 750 addFields --- whether to add new fields found in source layers (to be used with accessMode == 'append') 751 forceNullable --- whether to drop NOT NULL constraints on newly created fields 752 emptyStrAsNull --- whether to treat empty string values as NULL 753 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box 754 spatSRS --- SRS in which the spatFilter is expressed. If not specified, it is assumed to be the one of the layer(s) 755 datasetCreationOptions --- list of dataset creation options 756 layerCreationOptions --- list of layer creation options 757 layers --- list of layers to convert 758 layerName --- output layer name 759 geometryType --- output layer geometry type ('POINT', ....) 760 dim --- output dimension ('XY', 'XYZ', 'XYM', 'XYZM', 'layer_dim') 761 segmentizeMaxDist --- maximum distance between consecutive nodes of a line geometry 762 makeValid --- run MakeValid() on geometries 763 zField --- name of field to use to set the Z component of geometries 764 resolveDomains --- whether to create an additional field for each field associated with a coded field domain. 765 skipFailures --- whether to skip failures 766 limit -- maximum number of features to read per layer 767 callback --- callback method 768 callback_data --- user data for callback 769 """ 770 options = [] if options is None else options 771 772 if isinstance(options, str): 773 new_options = ParseCommandLine(options) 774 else: 775 new_options = options 776 if format is not None: 777 new_options += ['-f', format] 778 if srcSRS is not None: 779 new_options += ['-s_srs', str(srcSRS)] 780 if dstSRS is not None: 781 if reproject: 782 new_options += ['-t_srs', str(dstSRS)] 783 else: 784 new_options += ['-a_srs', str(dstSRS)] 785 if coordinateOperation is not None: 786 new_options += ['-ct', coordinateOperation] 787 if SQLStatement is not None: 788 new_options += ['-sql', str(SQLStatement)] 789 if SQLDialect is not None: 790 new_options += ['-dialect', str(SQLDialect)] 791 if where is not None: 792 new_options += ['-where', str(where)] 793 if accessMode is not None: 794 if accessMode == 'update': 795 new_options += ['-update'] 796 elif accessMode == 'append': 797 new_options += ['-append'] 798 elif accessMode == 'overwrite': 799 new_options += ['-overwrite'] 800 else: 801 raise Exception('unhandled accessMode') 802 if addFields: 803 new_options += ['-addfields'] 804 if forceNullable: 805 new_options += ['-forceNullable'] 806 if emptyStrAsNull: 807 new_options += ['-emptyStrAsNull'] 808 if selectFields is not None: 809 val = '' 810 for item in selectFields: 811 if val: 812 val += ',' 813 val += item 814 new_options += ['-select', val] 815 if datasetCreationOptions is not None: 816 for opt in datasetCreationOptions: 817 new_options += ['-dsco', opt] 818 if layerCreationOptions is not None: 819 for opt in layerCreationOptions: 820 new_options += ['-lco', opt] 821 if layers is not None: 822 if isinstance(layers, str): 823 new_options += [layers] 824 else: 825 for lyr in layers: 826 new_options += [lyr] 827 if segmentizeMaxDist is not None: 828 new_options += ['-segmentize', str(segmentizeMaxDist)] 829 if makeValid: 830 new_options += ['-makevalid'] 831 if spatFilter is not None: 832 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3])] 833 if spatSRS is not None: 834 new_options += ['-spat_srs', str(spatSRS)] 835 if layerName is not None: 836 new_options += ['-nln', layerName] 837 if geometryType is not None: 838 if isinstance(geometryType, str): 839 new_options += ['-nlt', geometryType] 840 else: 841 for opt in geometryType: 842 new_options += ['-nlt', opt] 843 if dim is not None: 844 new_options += ['-dim', dim] 845 if zField is not None: 846 new_options += ['-zfield', zField] 847 if resolveDomains: 848 new_options += ['-resolveDomains'] 849 if skipFailures: 850 new_options += ['-skip'] 851 if limit is not None: 852 new_options += ['-limit', str(limit)] 853 if callback is not None: 854 new_options += ['-progress'] 855 856 return (GDALVectorTranslateOptions(new_options), callback, callback_data)
857
858 -def VectorTranslate(destNameOrDestDS, srcDS, **kwargs):
859 """ Convert one vector dataset 860 Arguments are : 861 destNameOrDestDS --- Output dataset name or object 862 srcDS --- a Dataset object or a filename 863 Keyword arguments are : 864 options --- return of gdal.VectorTranslateOptions(), string or array of strings 865 other keywords arguments of gdal.VectorTranslateOptions() 866 If options is provided as a gdal.VectorTranslateOptions() object, other keywords are ignored. """ 867 868 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 869 (opts, callback, callback_data) = VectorTranslateOptions(**kwargs) 870 else: 871 (opts, callback, callback_data) = kwargs['options'] 872 if isinstance(srcDS, str): 873 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR) 874 875 if isinstance(destNameOrDestDS, str): 876 return wrapper_GDALVectorTranslateDestName(destNameOrDestDS, srcDS, opts, callback, callback_data) 877 else: 878 return wrapper_GDALVectorTranslateDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
879
880 -def DEMProcessingOptions(options=None, colorFilename=None, format=None, 881 creationOptions=None, computeEdges=False, alg=None, band=1, 882 zFactor=None, scale=None, azimuth=None, altitude=None, 883 combined=False, multiDirectional=False, igor=False, 884 slopeFormat=None, trigonometric=False, zeroForFlat=False, 885 addAlpha=None, colorSelection=None, 886 callback=None, callback_data=None):
887 """ Create a DEMProcessingOptions() object that can be passed to gdal.DEMProcessing() 888 Keyword arguments are : 889 options --- can be be an array of strings, a string or let empty and filled from other keywords. 890 colorFilename --- (mandatory for "color-relief") name of file that contains palette definition for the "color-relief" processing. 891 format --- output format ("GTiff", etc...) 892 creationOptions --- list of creation options 893 computeEdges --- whether to compute values at raster edges. 894 alg --- 'Horn' (default) or 'ZevenbergenThorne' for hillshade, slope or aspect. 'Wilson' (default) or 'Riley' for TRI 895 band --- source band number to use 896 zFactor --- (hillshade only) vertical exaggeration used to pre-multiply the elevations. 897 scale --- ratio of vertical units to horizontal. 898 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. 899 altitude ---(hillshade only) altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light. 900 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. 901 multiDirectional --- (hillshade only) whether to compute multi-directional shading. Only one of combined, multiDirectional and igor can be specified. 902 igor --- (hillshade only) whether to use Igor's hillshading from Maperitive. Only one of combined, multiDirectional and igor can be specified. 903 slopeformat --- (slope only) "degree" or "percent". 904 trigonometric --- (aspect only) whether to return trigonometric angle instead of azimuth. Thus 0deg means East, 90deg North, 180deg West, 270deg South. 905 zeroForFlat --- (aspect only) whether to return 0 for flat areas with slope=0, instead of -9999. 906 addAlpha --- adds an alpha band to the output file (only for processing = 'color-relief') 907 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" 908 callback --- callback method 909 callback_data --- user data for callback 910 """ 911 options = [] if options is None else options 912 913 if isinstance(options, str): 914 new_options = ParseCommandLine(options) 915 else: 916 new_options = options 917 if format is not None: 918 new_options += ['-of', format] 919 if creationOptions is not None: 920 for opt in creationOptions: 921 new_options += ['-co', opt] 922 if computeEdges: 923 new_options += ['-compute_edges'] 924 if alg: 925 new_options += ['-alg', alg] 926 new_options += ['-b', str(band)] 927 if zFactor is not None: 928 new_options += ['-z', str(zFactor)] 929 if scale is not None: 930 new_options += ['-s', str(scale)] 931 if azimuth is not None: 932 new_options += ['-az', str(azimuth)] 933 if altitude is not None: 934 new_options += ['-alt', str(altitude)] 935 if combined: 936 new_options += ['-combined'] 937 if multiDirectional: 938 new_options += ['-multidirectional'] 939 if igor: 940 new_options += ['-igor'] 941 if slopeFormat == 'percent': 942 new_options += ['-p'] 943 if trigonometric: 944 new_options += ['-trigonometric'] 945 if zeroForFlat: 946 new_options += ['-zero_for_flat'] 947 if colorSelection is not None: 948 if colorSelection == 'nearest_color_entry': 949 new_options += ['-nearest_color_entry'] 950 elif colorSelection == 'exact_color_entry': 951 new_options += ['-exact_color_entry'] 952 elif colorSelection == 'linear_interpolation': 953 pass 954 else: 955 raise ValueError("Unsupported value for colorSelection") 956 if addAlpha: 957 new_options += ['-alpha'] 958 959 return (GDALDEMProcessingOptions(new_options), colorFilename, callback, callback_data)
960
961 -def DEMProcessing(destName, srcDS, processing, **kwargs):
962 """ Apply a DEM processing. 963 Arguments are : 964 destName --- Output dataset name 965 srcDS --- a Dataset object or a filename 966 processing --- one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness" 967 Keyword arguments are : 968 options --- return of gdal.DEMProcessingOptions(), string or array of strings 969 other keywords arguments of gdal.DEMProcessingOptions() 970 If options is provided as a gdal.DEMProcessingOptions() object, other keywords are ignored. """ 971 972 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 973 (opts, colorFilename, callback, callback_data) = DEMProcessingOptions(**kwargs) 974 else: 975 (opts, colorFilename, callback, callback_data) = kwargs['options'] 976 if isinstance(srcDS, str): 977 srcDS = Open(srcDS) 978 979 return DEMProcessingInternal(destName, srcDS, processing, colorFilename, opts, callback, callback_data)
980 981
982 -def NearblackOptions(options=None, format=None, 983 creationOptions=None, white = False, colors=None, 984 maxNonBlack=None, nearDist=None, setAlpha = False, setMask = False, 985 callback=None, callback_data=None):
986 """ Create a NearblackOptions() object that can be passed to gdal.Nearblack() 987 Keyword arguments are : 988 options --- can be be an array of strings, a string or let empty and filled from other keywords. 989 format --- output format ("GTiff", etc...) 990 creationOptions --- list of creation options 991 white --- whether to search for nearly white (255) pixels instead of nearly black pixels. 992 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 993 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. 994 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. 995 setAlpha --- adds an alpha band to the output file. 996 setMask --- adds a mask band to the output file. 997 callback --- callback method 998 callback_data --- user data for callback 999 """ 1000 options = [] if options is None else options 1001 1002 if isinstance(options, str): 1003 new_options = ParseCommandLine(options) 1004 else: 1005 new_options = options 1006 if format is not None: 1007 new_options += ['-of', format] 1008 if creationOptions is not None: 1009 for opt in creationOptions: 1010 new_options += ['-co', opt] 1011 if white: 1012 new_options += ['-white'] 1013 if colors is not None: 1014 for color in colors: 1015 color_str = '' 1016 for cpt in color: 1017 if color_str != '': 1018 color_str += ',' 1019 color_str += str(cpt) 1020 new_options += ['-color', color_str] 1021 if maxNonBlack is not None: 1022 new_options += ['-nb', str(maxNonBlack)] 1023 if nearDist is not None: 1024 new_options += ['-near', str(nearDist)] 1025 if setAlpha: 1026 new_options += ['-setalpha'] 1027 if setMask: 1028 new_options += ['-setmask'] 1029 1030 return (GDALNearblackOptions(new_options), callback, callback_data)
1031
1032 -def Nearblack(destNameOrDestDS, srcDS, **kwargs):
1033 """ Convert nearly black/white borders to exact value. 1034 Arguments are : 1035 destNameOrDestDS --- Output dataset name or object 1036 srcDS --- a Dataset object or a filename 1037 Keyword arguments are : 1038 options --- return of gdal.NearblackOptions(), string or array of strings 1039 other keywords arguments of gdal.NearblackOptions() 1040 If options is provided as a gdal.NearblackOptions() object, other keywords are ignored. """ 1041 1042 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1043 (opts, callback, callback_data) = NearblackOptions(**kwargs) 1044 else: 1045 (opts, callback, callback_data) = kwargs['options'] 1046 if isinstance(srcDS, str): 1047 srcDS = OpenEx(srcDS) 1048 1049 if isinstance(destNameOrDestDS, str): 1050 return wrapper_GDALNearblackDestName(destNameOrDestDS, srcDS, opts, callback, callback_data) 1051 else: 1052 return wrapper_GDALNearblackDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1053 1054
1055 -def GridOptions(options=None, format=None, 1056 outputType=gdalconst.GDT_Unknown, 1057 width=0, height=0, 1058 creationOptions=None, 1059 outputBounds=None, 1060 outputSRS=None, 1061 noData=None, 1062 algorithm=None, 1063 layers=None, 1064 SQLStatement=None, 1065 where=None, 1066 spatFilter=None, 1067 zfield=None, 1068 z_increase=None, 1069 z_multiply=None, 1070 callback=None, callback_data=None):
1071 """ Create a GridOptions() object that can be passed to gdal.Grid() 1072 Keyword arguments are : 1073 options --- can be be an array of strings, a string or let empty and filled from other keywords. 1074 format --- output format ("GTiff", etc...) 1075 outputType --- output type (gdalconst.GDT_Byte, etc...) 1076 width --- width of the output raster in pixel 1077 height --- height of the output raster in pixel 1078 creationOptions --- list of creation options 1079 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry] 1080 outputSRS --- assigned output SRS 1081 noData --- nodata value 1082 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" 1083 layers --- list of layers to convert 1084 SQLStatement --- SQL statement to apply to the source dataset 1085 where --- WHERE clause to apply to source layer(s) 1086 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box 1087 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. 1088 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. 1089 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. 1090 callback --- callback method 1091 callback_data --- user data for callback 1092 """ 1093 options = [] if options is None else options 1094 1095 if isinstance(options, str): 1096 new_options = ParseCommandLine(options) 1097 else: 1098 new_options = options 1099 if format is not None: 1100 new_options += ['-of', format] 1101 if outputType != gdalconst.GDT_Unknown: 1102 new_options += ['-ot', GetDataTypeName(outputType)] 1103 if width != 0 or height != 0: 1104 new_options += ['-outsize', str(width), str(height)] 1105 if creationOptions is not None: 1106 for opt in creationOptions: 1107 new_options += ['-co', opt] 1108 if outputBounds is not None: 1109 new_options += ['-txe', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[2]), '-tye', _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[3])] 1110 if outputSRS is not None: 1111 new_options += ['-a_srs', str(outputSRS)] 1112 if algorithm is not None: 1113 new_options += ['-a', algorithm] 1114 if layers is not None: 1115 if isinstance(layers, (tuple, list)): 1116 for layer in layers: 1117 new_options += ['-l', layer] 1118 else: 1119 new_options += ['-l', layers] 1120 if SQLStatement is not None: 1121 new_options += ['-sql', str(SQLStatement)] 1122 if where is not None: 1123 new_options += ['-where', str(where)] 1124 if zfield is not None: 1125 new_options += ['-zfield', zfield] 1126 if z_increase is not None: 1127 new_options += ['-z_increase', str(z_increase)] 1128 if z_multiply is not None: 1129 new_options += ['-z_multiply', str(z_multiply)] 1130 if spatFilter is not None: 1131 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3])] 1132 1133 return (GDALGridOptions(new_options), callback, callback_data)
1134
1135 -def Grid(destName, srcDS, **kwargs):
1136 """ Create raster from the scattered data. 1137 Arguments are : 1138 destName --- Output dataset name 1139 srcDS --- a Dataset object or a filename 1140 Keyword arguments are : 1141 options --- return of gdal.GridOptions(), string or array of strings 1142 other keywords arguments of gdal.GridOptions() 1143 If options is provided as a gdal.GridOptions() object, other keywords are ignored. """ 1144 1145 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1146 (opts, callback, callback_data) = GridOptions(**kwargs) 1147 else: 1148 (opts, callback, callback_data) = kwargs['options'] 1149 if isinstance(srcDS, str): 1150 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR) 1151 1152 return GridInternal(destName, srcDS, opts, callback, callback_data)
1153
1154 -def RasterizeOptions(options=None, format=None, 1155 outputType=gdalconst.GDT_Unknown, 1156 creationOptions=None, noData=None, initValues=None, 1157 outputBounds=None, outputSRS=None, 1158 transformerOptions=None, 1159 width=None, height=None, 1160 xRes=None, yRes=None, targetAlignedPixels=False, 1161 bands=None, inverse=False, allTouched=False, 1162 burnValues=None, attribute=None, useZ=False, layers=None, 1163 SQLStatement=None, SQLDialect=None, where=None, optim=None, 1164 add=None, 1165 callback=None, callback_data=None):
1166 """ Create a RasterizeOptions() object that can be passed to gdal.Rasterize() 1167 Keyword arguments are : 1168 options --- can be be an array of strings, a string or let empty and filled from other keywords. 1169 format --- output format ("GTiff", etc...) 1170 outputType --- output type (gdalconst.GDT_Byte, etc...) 1171 creationOptions --- list of creation options 1172 outputBounds --- assigned output bounds: [minx, miny, maxx, maxy] 1173 outputSRS --- assigned output SRS 1174 transformerOptions --- list of transformer options 1175 width --- width of the output raster in pixel 1176 height --- height of the output raster in pixel 1177 xRes, yRes --- output resolution in target SRS 1178 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution 1179 noData --- nodata value 1180 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. 1181 bands --- list of output bands to burn values into 1182 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. 1183 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. 1184 burnValues -- list of fixed values to burn into each band for all objects. Excusive with attribute. 1185 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. 1186 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. 1187 layers --- list of layers from the datasource that will be used for input features. 1188 SQLStatement --- SQL statement to apply to the source dataset 1189 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...) 1190 where --- WHERE clause to apply to source layer(s) 1191 optim --- optimization mode ('RASTER', 'VECTOR') 1192 add --- set to True to use additive mode instead of replace when burning values 1193 callback --- callback method 1194 callback_data --- user data for callback 1195 """ 1196 options = [] if options is None else options 1197 1198 if isinstance(options, str): 1199 new_options = ParseCommandLine(options) 1200 else: 1201 new_options = options 1202 if format is not None: 1203 new_options += ['-of', format] 1204 if outputType != gdalconst.GDT_Unknown: 1205 new_options += ['-ot', GetDataTypeName(outputType)] 1206 if creationOptions is not None: 1207 for opt in creationOptions: 1208 new_options += ['-co', opt] 1209 if bands is not None: 1210 for b in bands: 1211 new_options += ['-b', str(b)] 1212 if noData is not None: 1213 new_options += ['-a_nodata', str(noData)] 1214 if initValues is not None: 1215 if isinstance(initValues, (tuple, list)): 1216 for val in initValues: 1217 new_options += ['-init', str(val)] 1218 else: 1219 new_options += ['-init', str(initValues)] 1220 if outputBounds is not None: 1221 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 1222 if outputSRS is not None: 1223 new_options += ['-a_srs', str(outputSRS)] 1224 if transformerOptions is not None: 1225 for opt in transformerOptions: 1226 new_options += ['-to', opt] 1227 if width is not None and height is not None: 1228 new_options += ['-ts', str(width), str(height)] 1229 if xRes is not None and yRes is not None: 1230 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 1231 if targetAlignedPixels: 1232 new_options += ['-tap'] 1233 if inverse: 1234 new_options += ['-i'] 1235 if allTouched: 1236 new_options += ['-at'] 1237 if burnValues is not None: 1238 if attribute is not None: 1239 raise Exception('burnValues and attribute option are exclusive.') 1240 if isinstance(burnValues, (tuple, list)): 1241 for val in burnValues: 1242 new_options += ['-burn', str(val)] 1243 else: 1244 new_options += ['-burn', str(burnValues)] 1245 if attribute is not None: 1246 new_options += ['-a', attribute] 1247 if useZ: 1248 new_options += ['-3d'] 1249 if layers is not None: 1250 if isinstance(layers, ((tuple, list))): 1251 for layer in layers: 1252 new_options += ['-l', layer] 1253 else: 1254 new_options += ['-l', layers] 1255 if SQLStatement is not None: 1256 new_options += ['-sql', str(SQLStatement)] 1257 if SQLDialect is not None: 1258 new_options += ['-dialect', str(SQLDialect)] 1259 if where is not None: 1260 new_options += ['-where', str(where)] 1261 if optim is not None: 1262 new_options += ['-optim', str(optim)] 1263 if add: 1264 new_options += ['-add'] 1265 1266 return (GDALRasterizeOptions(new_options), callback, callback_data)
1267
1268 -def Rasterize(destNameOrDestDS, srcDS, **kwargs):
1269 """ Burns vector geometries into a raster 1270 Arguments are : 1271 destNameOrDestDS --- Output dataset name or object 1272 srcDS --- a Dataset object or a filename 1273 Keyword arguments are : 1274 options --- return of gdal.RasterizeOptions(), string or array of strings 1275 other keywords arguments of gdal.RasterizeOptions() 1276 If options is provided as a gdal.RasterizeOptions() object, other keywords are ignored. """ 1277 1278 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1279 (opts, callback, callback_data) = RasterizeOptions(**kwargs) 1280 else: 1281 (opts, callback, callback_data) = kwargs['options'] 1282 if isinstance(srcDS, str): 1283 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR) 1284 1285 if isinstance(destNameOrDestDS, str): 1286 return wrapper_GDALRasterizeDestName(destNameOrDestDS, srcDS, opts, callback, callback_data) 1287 else: 1288 return wrapper_GDALRasterizeDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1289 1290
1291 -def BuildVRTOptions(options=None, 1292 resolution=None, 1293 outputBounds=None, 1294 xRes=None, yRes=None, 1295 targetAlignedPixels=None, 1296 separate=None, 1297 bandList=None, 1298 addAlpha=None, 1299 resampleAlg=None, 1300 outputSRS=None, 1301 allowProjectionDifference=None, 1302 srcNodata=None, 1303 VRTNodata=None, 1304 hideNodata=None, 1305 strict=False, 1306 callback=None, callback_data=None):
1307 """ Create a BuildVRTOptions() object that can be passed to gdal.BuildVRT() 1308 Keyword arguments are : 1309 options --- can be be an array of strings, a string or let empty and filled from other keywords.. 1310 resolution --- 'highest', 'lowest', 'average', 'user'. 1311 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS. 1312 xRes, yRes --- output resolution in target SRS. 1313 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution. 1314 separate --- whether each source file goes into a separate stacked band in the VRT band. 1315 bandList --- array of band numbers (index start at 1). 1316 addAlpha --- whether to add an alpha mask band to the VRT when the source raster have none. 1317 resampleAlg --- resampling mode. 1318 outputSRS --- assigned output SRS. 1319 allowProjectionDifference --- whether to accept input datasets have not the same projection. Note: they will *not* be reprojected. 1320 srcNodata --- source nodata value(s). 1321 VRTNodata --- nodata values at the VRT band level. 1322 hideNodata --- whether to make the VRT band not report the NoData value. 1323 strict --- set to True if warnings should be failures 1324 callback --- callback method. 1325 callback_data --- user data for callback. 1326 """ 1327 1328 # Only used for tests 1329 return_option_list = options == '__RETURN_OPTION_LIST__' 1330 if return_option_list: 1331 options = [] 1332 else: 1333 options = [] if options is None else options 1334 1335 if isinstance(options, str): 1336 new_options = ParseCommandLine(options) 1337 else: 1338 new_options = options 1339 if resolution is not None: 1340 new_options += ['-resolution', str(resolution)] 1341 if outputBounds is not None: 1342 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 1343 if xRes is not None and yRes is not None: 1344 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 1345 if targetAlignedPixels: 1346 new_options += ['-tap'] 1347 if separate: 1348 new_options += ['-separate'] 1349 if bandList != None: 1350 for b in bandList: 1351 new_options += ['-b', str(b)] 1352 if addAlpha: 1353 new_options += ['-addalpha'] 1354 if resampleAlg is not None: 1355 if resampleAlg in mapGRIORAMethodToString: 1356 new_options += ['-r', mapGRIORAMethodToString[resampleAlg]] 1357 else: 1358 new_options += ['-r', str(resampleAlg)] 1359 if outputSRS is not None: 1360 new_options += ['-a_srs', str(outputSRS)] 1361 if allowProjectionDifference: 1362 new_options += ['-allow_projection_difference'] 1363 if srcNodata is not None: 1364 new_options += ['-srcnodata', str(srcNodata)] 1365 if VRTNodata is not None: 1366 new_options += ['-vrtnodata', str(VRTNodata)] 1367 if hideNodata: 1368 new_options += ['-hidenodata'] 1369 if strict: 1370 new_options += ['-strict'] 1371 1372 if return_option_list: 1373 return new_options 1374 1375 return (GDALBuildVRTOptions(new_options), callback, callback_data)
1376
1377 -def BuildVRT(destName, srcDSOrSrcDSTab, **kwargs):
1378 """ Build a VRT from a list of datasets. 1379 Arguments are : 1380 destName --- Output dataset name 1381 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename 1382 Keyword arguments are : 1383 options --- return of gdal.BuildVRTOptions(), string or array of strings 1384 other keywords arguments of gdal.BuildVRTOptions() 1385 If options is provided as a gdal.BuildVRTOptions() object, other keywords are ignored. """ 1386 1387 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1388 (opts, callback, callback_data) = BuildVRTOptions(**kwargs) 1389 else: 1390 (opts, callback, callback_data) = kwargs['options'] 1391 1392 srcDSTab = [] 1393 srcDSNamesTab = [] 1394 if isinstance(srcDSOrSrcDSTab, str): 1395 srcDSNamesTab = [srcDSOrSrcDSTab] 1396 elif isinstance(srcDSOrSrcDSTab, list): 1397 for elt in srcDSOrSrcDSTab: 1398 if isinstance(elt, str): 1399 srcDSNamesTab.append(elt) 1400 else: 1401 srcDSTab.append(elt) 1402 if srcDSTab and srcDSNamesTab: 1403 raise Exception('Mix of names and dataset objects not supported') 1404 else: 1405 srcDSTab = [srcDSOrSrcDSTab] 1406 1407 if srcDSTab: 1408 return BuildVRTInternalObjects(destName, srcDSTab, opts, callback, callback_data) 1409 else: 1410 return BuildVRTInternalNames(destName, srcDSNamesTab, opts, callback, callback_data)
1411 1412
1413 -def MultiDimTranslateOptions(options=None, format=None, creationOptions=None, 1414 arraySpecs=None, groupSpecs=None, subsetSpecs=None, scaleAxesSpecs=None, 1415 callback=None, callback_data=None):
1416 """ Create a MultiDimTranslateOptions() object that can be passed to gdal.MultiDimTranslate() 1417 Keyword arguments are : 1418 options --- can be be an array of strings, a string or let empty and filled from other keywords. 1419 format --- output format ("GTiff", etc...) 1420 creationOptions --- list of creation options 1421 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]" 1422 groupSpecs -- list of group specifications, each of them being a group name or "name={src_array_name},dstname={dst_name},recursive=no" 1423 subsetSpecs -- list of subset specifications, each of them being like "{dim_name}({min_val},{max_val})" or "{dim_name}({slice_va})" 1424 scaleAxesSpecs -- list of dimension scaling specifications, each of them being like "{dim_name}({scale_factor})" 1425 callback --- callback method 1426 callback_data --- user data for callback 1427 """ 1428 options = [] if options is None else options 1429 1430 if isinstance(options, str): 1431 new_options = ParseCommandLine(options) 1432 else: 1433 new_options = options 1434 if format is not None: 1435 new_options += ['-of', format] 1436 if creationOptions is not None: 1437 for opt in creationOptions: 1438 new_options += ['-co', opt] 1439 if arraySpecs is not None: 1440 for s in arraySpecs: 1441 new_options += ['-array', s] 1442 if groupSpecs is not None: 1443 for s in groupSpecs: 1444 new_options += ['-group', s] 1445 if subsetSpecs is not None: 1446 for s in subsetSpecs: 1447 new_options += ['-subset', s] 1448 if scaleAxesSpecs is not None: 1449 for s in scaleAxesSpecs: 1450 new_options += ['-scaleaxes', s] 1451 1452 return (GDALMultiDimTranslateOptions(new_options), callback, callback_data)
1453
1454 -def MultiDimTranslate(destName, srcDSOrSrcDSTab, **kwargs):
1455 """ MultiDimTranslate one or several datasets. 1456 Arguments are : 1457 destName --- Output dataset name 1458 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename 1459 Keyword arguments are : 1460 options --- return of gdal.MultiDimTranslateOptions(), string or array of strings 1461 other keywords arguments of gdal.MultiDimTranslateOptions() 1462 If options is provided as a gdal.MultiDimTranslateOptions() object, other keywords are ignored. """ 1463 1464 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1465 (opts, callback, callback_data) = MultiDimTranslateOptions(**kwargs) 1466 else: 1467 (opts, callback, callback_data) = kwargs['options'] 1468 if isinstance(srcDSOrSrcDSTab, str): 1469 srcDSTab = [OpenEx(srcDSOrSrcDSTab, OF_VERBOSE_ERROR | OF_RASTER | OF_MULTIDIM_RASTER)] 1470 elif isinstance(srcDSOrSrcDSTab, list): 1471 srcDSTab = [] 1472 for elt in srcDSOrSrcDSTab: 1473 if isinstance(elt, str): 1474 srcDSTab.append(OpenEx(elt, OF_VERBOSE_ERROR | OF_RASTER | OF_MULTIDIM_RASTER)) 1475 else: 1476 srcDSTab.append(elt) 1477 else: 1478 srcDSTab = [srcDSOrSrcDSTab] 1479 1480 return wrapper_GDALMultiDimTranslateDestName(destName, srcDSTab, opts, callback, callback_data)
1481 1482 # Logging Helpers
1483 -def _pylog_handler(err_level, err_no, err_msg):
1484 if err_no != gdalconst.CPLE_None: 1485 typ = _pylog_handler.errcode_map.get(err_no, str(err_no)) 1486 message = "%s: %s" % (typ, err_msg) 1487 else: 1488 message = err_msg 1489 1490 level = _pylog_handler.level_map.get(err_level, 20) # default level is INFO 1491 _pylog_handler.logger.log(level, message)
1492
1493 -def ConfigurePythonLogging(logger_name='gdal', enable_debug=False):
1494 """ Configure GDAL to use Python's logging framework """ 1495 import logging 1496 1497 _pylog_handler.logger = logging.getLogger(logger_name) 1498 1499 # map CPLE_* constants to names 1500 _pylog_handler.errcode_map = {_num: _name[5:] for _name, _num in gdalconst.__dict__.items() if _name.startswith('CPLE_')} 1501 1502 # Map GDAL log levels to Python's 1503 _pylog_handler.level_map = { 1504 CE_None: logging.INFO, 1505 CE_Debug: logging.DEBUG, 1506 CE_Warning: logging.WARN, 1507 CE_Failure: logging.ERROR, 1508 CE_Fatal: logging.CRITICAL, 1509 } 1510 1511 # Set CPL_DEBUG so debug messages are passed through the logger 1512 if enable_debug: 1513 SetConfigOption("CPL_DEBUG", "ON") 1514 1515 # Install as the default GDAL log handler 1516 SetErrorHandler(_pylog_handler)
1517 1518
1519 -def EscapeString(*args, **kwargs):
1520 """EscapeString(string_or_bytes, scheme = gdal.CPLES_SQL)""" 1521 if isinstance(args[0], bytes): 1522 return _gdal.EscapeBinary(*args, **kwargs) 1523 else: 1524 return _gdal.wrapper_EscapeString(*args, **kwargs)
1525 1526
1527 -def ApplyVerticalShiftGrid(*args, **kwargs):
1528 """ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) -> Dataset""" 1529 1530 from warnings import warn 1531 warn('ApplyVerticalShiftGrid() will be removed in GDAL 4.0', DeprecationWarning) 1532 return _ApplyVerticalShiftGrid(*args, **kwargs)
1533 1534 1535
1536 -def Debug(*args):
1537 """Debug(char const * msg_class, char const * message)""" 1538 return _gdal.Debug(*args)
1539
1540 -def SetErrorHandler(*args):
1541 """SetErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr""" 1542 return _gdal.SetErrorHandler(*args)
1543
1544 -def SetCurrentErrorHandlerCatchDebug(*args):
1545 """SetCurrentErrorHandlerCatchDebug(int bCatchDebug)""" 1546 return _gdal.SetCurrentErrorHandlerCatchDebug(*args)
1547
1548 -def PushErrorHandler(*args):
1549 """PushErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr""" 1550 return _gdal.PushErrorHandler(*args)
1551
1552 -def PopErrorHandler(*args):
1553 """PopErrorHandler()""" 1554 return _gdal.PopErrorHandler(*args)
1555
1556 -def Error(*args):
1557 """Error(CPLErr msg_class, int err_code=0, char const * msg)""" 1558 return _gdal.Error(*args)
1559
1560 -def GOA2GetAuthorizationURL(*args):
1561 """GOA2GetAuthorizationURL(char const * pszScope) -> retStringAndCPLFree *""" 1562 return _gdal.GOA2GetAuthorizationURL(*args)
1563
1564 -def GOA2GetRefreshToken(*args):
1565 """GOA2GetRefreshToken(char const * pszAuthToken, char const * pszScope) -> retStringAndCPLFree *""" 1566 return _gdal.GOA2GetRefreshToken(*args)
1567
1568 -def GOA2GetAccessToken(*args):
1569 """GOA2GetAccessToken(char const * pszRefreshToken, char const * pszScope) -> retStringAndCPLFree *""" 1570 return _gdal.GOA2GetAccessToken(*args)
1571
1572 -def ErrorReset(*args):
1573 """ErrorReset()""" 1574 return _gdal.ErrorReset(*args)
1575
1576 -def wrapper_EscapeString(*args, **kwargs):
1577 """wrapper_EscapeString(int len, int scheme) -> retStringAndCPLFree *""" 1578 return _gdal.wrapper_EscapeString(*args, **kwargs)
1579
1580 -def EscapeBinary(*args, **kwargs):
1581 """EscapeBinary(int len, int scheme)""" 1582 return _gdal.EscapeBinary(*args, **kwargs)
1583
1584 -def GetLastErrorNo(*args):
1585 """GetLastErrorNo() -> int""" 1586 return _gdal.GetLastErrorNo(*args)
1587
1588 -def GetLastErrorType(*args):
1589 """GetLastErrorType() -> int""" 1590 return _gdal.GetLastErrorType(*args)
1591
1592 -def GetLastErrorMsg(*args):
1593 """GetLastErrorMsg() -> char const *""" 1594 return _gdal.GetLastErrorMsg(*args)
1595
1596 -def GetErrorCounter(*args):
1597 """GetErrorCounter() -> unsigned int""" 1598 return _gdal.GetErrorCounter(*args)
1599
1600 -def VSIGetLastErrorNo(*args):
1601 """VSIGetLastErrorNo() -> int""" 1602 return _gdal.VSIGetLastErrorNo(*args)
1603
1604 -def VSIGetLastErrorMsg(*args):
1605 """VSIGetLastErrorMsg() -> char const *""" 1606 return _gdal.VSIGetLastErrorMsg(*args)
1607
1608 -def VSIErrorReset(*args):
1609 """VSIErrorReset()""" 1610 return _gdal.VSIErrorReset(*args)
1611
1612 -def PushFinderLocation(*args):
1613 """PushFinderLocation(char const * utf8_path)""" 1614 return _gdal.PushFinderLocation(*args)
1615
1616 -def PopFinderLocation(*args):
1617 """PopFinderLocation()""" 1618 return _gdal.PopFinderLocation(*args)
1619
1620 -def FinderClean(*args):
1621 """FinderClean()""" 1622 return _gdal.FinderClean(*args)
1623
1624 -def FindFile(*args):
1625 """FindFile(char const * pszClass, char const * utf8_path) -> char const *""" 1626 return _gdal.FindFile(*args)
1627
1628 -def ReadDir(*args):
1629 """ReadDir(char const * utf8_path, int nMaxFiles=0) -> char **""" 1630 return _gdal.ReadDir(*args)
1631
1632 -def ReadDirRecursive(*args):
1633 """ReadDirRecursive(char const * utf8_path) -> char **""" 1634 return _gdal.ReadDirRecursive(*args)
1635
1636 -def OpenDir(*args):
1637 """OpenDir(char const * utf8_path, int nRecurseDepth=-1, char ** options=None) -> VSIDIR *""" 1638 return _gdal.OpenDir(*args)
1639 -class DirEntry(_object):
1640 """Proxy of C++ DirEntry class.""" 1641 1642 __swig_setmethods__ = {} 1643 __setattr__ = lambda self, name, value: _swig_setattr(self, DirEntry, name, value) 1644 __swig_getmethods__ = {} 1645 __getattr__ = lambda self, name: _swig_getattr(self, DirEntry, name) 1646 __repr__ = _swig_repr 1647 __swig_getmethods__["name"] = _gdal.DirEntry_name_get 1648 if _newclass: 1649 name = _swig_property(_gdal.DirEntry_name_get) 1650 __swig_getmethods__["mode"] = _gdal.DirEntry_mode_get 1651 if _newclass: 1652 mode = _swig_property(_gdal.DirEntry_mode_get) 1653 __swig_getmethods__["size"] = _gdal.DirEntry_size_get 1654 if _newclass: 1655 size = _swig_property(_gdal.DirEntry_size_get) 1656 __swig_getmethods__["mtime"] = _gdal.DirEntry_mtime_get 1657 if _newclass: 1658 mtime = _swig_property(_gdal.DirEntry_mtime_get) 1659 __swig_getmethods__["modeKnown"] = _gdal.DirEntry_modeKnown_get 1660 if _newclass: 1661 modeKnown = _swig_property(_gdal.DirEntry_modeKnown_get) 1662 __swig_getmethods__["sizeKnown"] = _gdal.DirEntry_sizeKnown_get 1663 if _newclass: 1664 sizeKnown = _swig_property(_gdal.DirEntry_sizeKnown_get) 1665 __swig_getmethods__["mtimeKnown"] = _gdal.DirEntry_mtimeKnown_get 1666 if _newclass: 1667 mtimeKnown = _swig_property(_gdal.DirEntry_mtimeKnown_get) 1668 __swig_getmethods__["extra"] = _gdal.DirEntry_extra_get 1669 if _newclass: 1670 extra = _swig_property(_gdal.DirEntry_extra_get) 1671
1672 - def __init__(self, *args):
1673 """__init__(DirEntry self, DirEntry entryIn) -> DirEntry""" 1674 this = _gdal.new_DirEntry(*args) 1675 try: 1676 self.this.append(this) 1677 except __builtin__.Exception: 1678 self.this = this
1679 __swig_destroy__ = _gdal.delete_DirEntry 1680 __del__ = lambda self: None 1681
1682 - def IsDirectory(self, *args):
1683 """IsDirectory(DirEntry self) -> bool""" 1684 return _gdal.DirEntry_IsDirectory(self, *args)
1685 1686 DirEntry_swigregister = _gdal.DirEntry_swigregister 1687 DirEntry_swigregister(DirEntry) 1688 1689
1690 -def GetNextDirEntry(*args):
1691 """GetNextDirEntry(VSIDIR * dir) -> DirEntry""" 1692 return _gdal.GetNextDirEntry(*args)
1693
1694 -def CloseDir(*args):
1695 """CloseDir(VSIDIR * dir)""" 1696 return _gdal.CloseDir(*args)
1697
1698 -def SetConfigOption(*args):
1699 """SetConfigOption(char const * pszKey, char const * pszValue)""" 1700 return _gdal.SetConfigOption(*args)
1701
1702 -def SetThreadLocalConfigOption(*args):
1703 """SetThreadLocalConfigOption(char const * pszKey, char const * pszValue)""" 1704 return _gdal.SetThreadLocalConfigOption(*args)
1705
1706 -def GetConfigOption(*args):
1707 """GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *""" 1708 return _gdal.GetConfigOption(*args)
1709
1710 -def GetThreadLocalConfigOption(*args):
1711 """GetThreadLocalConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *""" 1712 return _gdal.GetThreadLocalConfigOption(*args)
1713
1714 -def SetCredential(*args):
1715 """SetCredential(char const * pszPathPrefix, char const * pszKey, char const * pszValue)""" 1716 return _gdal.SetCredential(*args)
1717
1718 -def GetCredential(*args):
1719 """GetCredential(char const * pszPathPrefix, char const * pszKey, char const * pszDefault=None) -> char const *""" 1720 return _gdal.GetCredential(*args)
1721
1722 -def ClearCredentials(*args):
1723 """ClearCredentials(char const * pszPathPrefix=None)""" 1724 return _gdal.ClearCredentials(*args)
1725
1726 -def CPLBinaryToHex(*args):
1727 """CPLBinaryToHex(int nBytes) -> retStringAndCPLFree *""" 1728 return _gdal.CPLBinaryToHex(*args)
1729
1730 -def CPLHexToBinary(*args):
1731 """CPLHexToBinary(char const * pszHex, int * pnBytes) -> GByte *""" 1732 return _gdal.CPLHexToBinary(*args)
1733
1734 -def FileFromMemBuffer(*args):
1735 """FileFromMemBuffer(char const * utf8_path, GIntBig nBytes)""" 1736 return _gdal.FileFromMemBuffer(*args)
1737 1741
1742 -def UnlinkBatch(*args):
1743 """UnlinkBatch(char ** files) -> bool""" 1744 return _gdal.UnlinkBatch(*args)
1745
1746 -def HasThreadSupport(*args):
1747 """HasThreadSupport() -> int""" 1748 return _gdal.HasThreadSupport(*args)
1749
1750 -def Mkdir(*args):
1751 """Mkdir(char const * utf8_path, int mode) -> VSI_RETVAL""" 1752 return _gdal.Mkdir(*args)
1753
1754 -def Rmdir(*args):
1755 """Rmdir(char const * utf8_path) -> VSI_RETVAL""" 1756 return _gdal.Rmdir(*args)
1757
1758 -def MkdirRecursive(*args):
1759 """MkdirRecursive(char const * utf8_path, int mode) -> VSI_RETVAL""" 1760 return _gdal.MkdirRecursive(*args)
1761
1762 -def RmdirRecursive(*args):
1763 """RmdirRecursive(char const * utf8_path) -> VSI_RETVAL""" 1764 return _gdal.RmdirRecursive(*args)
1765
1766 -def Rename(*args):
1767 """Rename(char const * pszOld, char const * pszNew) -> VSI_RETVAL""" 1768 return _gdal.Rename(*args)
1769
1770 -def Sync(*args, **kwargs):
1771 """Sync(char const * pszSource, char const * pszTarget, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> bool""" 1772 return _gdal.Sync(*args, **kwargs)
1773
1774 -def AbortPendingUploads(*args):
1775 """AbortPendingUploads(char const * utf8_path) -> bool""" 1776 return _gdal.AbortPendingUploads(*args)
1777
1778 -def GetActualURL(*args):
1779 """GetActualURL(char const * utf8_path) -> char const *""" 1780 return _gdal.GetActualURL(*args)
1781
1782 -def GetSignedURL(*args):
1783 """GetSignedURL(char const * utf8_path, char ** options=None) -> retStringAndCPLFree *""" 1784 return _gdal.GetSignedURL(*args)
1785
1786 -def GetFileSystemsPrefixes(*args):
1787 """GetFileSystemsPrefixes() -> char **""" 1788 return _gdal.GetFileSystemsPrefixes(*args)
1789
1790 -def GetFileSystemOptions(*args):
1791 """GetFileSystemOptions(char const * utf8_path) -> char const *""" 1792 return _gdal.GetFileSystemOptions(*args)
1793 -class VSILFILE(_object):
1794 """Proxy of C++ VSILFILE class.""" 1795 1796 __swig_setmethods__ = {} 1797 __setattr__ = lambda self, name, value: _swig_setattr(self, VSILFILE, name, value) 1798 __swig_getmethods__ = {} 1799 __getattr__ = lambda self, name: _swig_getattr(self, VSILFILE, name) 1800
1801 - def __init__(self, *args, **kwargs):
1802 raise AttributeError("No constructor defined")
1803 __repr__ = _swig_repr
1804 VSILFILE_swigregister = _gdal.VSILFILE_swigregister 1805 VSILFILE_swigregister(VSILFILE) 1806 1807 VSI_STAT_EXISTS_FLAG = _gdal.VSI_STAT_EXISTS_FLAG 1808 VSI_STAT_NATURE_FLAG = _gdal.VSI_STAT_NATURE_FLAG 1809 VSI_STAT_SIZE_FLAG = _gdal.VSI_STAT_SIZE_FLAG 1810 VSI_STAT_SET_ERROR_FLAG = _gdal.VSI_STAT_SET_ERROR_FLAG 1811 VSI_STAT_CACHE_ONLY = _gdal.VSI_STAT_CACHE_ONLY
1812 -class StatBuf(_object):
1813 """Proxy of C++ StatBuf class.""" 1814 1815 __swig_setmethods__ = {} 1816 __setattr__ = lambda self, name, value: _swig_setattr(self, StatBuf, name, value) 1817 __swig_getmethods__ = {} 1818 __getattr__ = lambda self, name: _swig_getattr(self, StatBuf, name) 1819 __repr__ = _swig_repr 1820 __swig_getmethods__["mode"] = _gdal.StatBuf_mode_get 1821 if _newclass: 1822 mode = _swig_property(_gdal.StatBuf_mode_get) 1823 __swig_getmethods__["size"] = _gdal.StatBuf_size_get 1824 if _newclass: 1825 size = _swig_property(_gdal.StatBuf_size_get) 1826 __swig_getmethods__["mtime"] = _gdal.StatBuf_mtime_get 1827 if _newclass: 1828 mtime = _swig_property(_gdal.StatBuf_mtime_get) 1829
1830 - def __init__(self, *args):
1831 """__init__(StatBuf self, StatBuf psStatBuf) -> StatBuf""" 1832 this = _gdal.new_StatBuf(*args) 1833 try: 1834 self.this.append(this) 1835 except __builtin__.Exception: 1836 self.this = this
1837 __swig_destroy__ = _gdal.delete_StatBuf 1838 __del__ = lambda self: None 1839
1840 - def IsDirectory(self, *args):
1841 """IsDirectory(StatBuf self) -> int""" 1842 return _gdal.StatBuf_IsDirectory(self, *args)
1843 1844 StatBuf_swigregister = _gdal.StatBuf_swigregister 1845 StatBuf_swigregister(StatBuf) 1846 1847
1848 -def VSIStatL(*args):
1849 """VSIStatL(char const * utf8_path, int nFlags=0) -> int""" 1850 return _gdal.VSIStatL(*args)
1851
1852 -def GetFileMetadata(*args):
1853 """GetFileMetadata(char const * utf8_path, char const * domain, char ** options=None) -> char **""" 1854 return _gdal.GetFileMetadata(*args)
1855
1856 -def SetFileMetadata(*args):
1857 """SetFileMetadata(char const * utf8_path, char ** metadata, char const * domain, char ** options=None) -> bool""" 1858 return _gdal.SetFileMetadata(*args)
1859
1860 -def VSIFOpenL(*args):
1861 """VSIFOpenL(char const * utf8_path, char const * pszMode) -> VSILFILE""" 1862 return _gdal.VSIFOpenL(*args)
1863
1864 -def VSIFOpenExL(*args):
1865 """VSIFOpenExL(char const * utf8_path, char const * pszMode, int bSetError=False, char ** options=None) -> VSILFILE""" 1866 return _gdal.VSIFOpenExL(*args)
1867
1868 -def VSIFEofL(*args):
1869 """VSIFEofL(VSILFILE fp) -> int""" 1870 return _gdal.VSIFEofL(*args)
1871
1872 -def VSIFFlushL(*args):
1873 """VSIFFlushL(VSILFILE fp) -> int""" 1874 return _gdal.VSIFFlushL(*args)
1875
1876 -def VSIFCloseL(*args):
1877 """VSIFCloseL(VSILFILE fp) -> VSI_RETVAL""" 1878 return _gdal.VSIFCloseL(*args)
1879
1880 -def VSIFSeekL(*args):
1881 """VSIFSeekL(VSILFILE fp, GIntBig offset, int whence) -> int""" 1882 return _gdal.VSIFSeekL(*args)
1883
1884 -def VSIFTellL(*args):
1885 """VSIFTellL(VSILFILE fp) -> GIntBig""" 1886 return _gdal.VSIFTellL(*args)
1887
1888 -def VSIFTruncateL(*args):
1889 """VSIFTruncateL(VSILFILE fp, GIntBig length) -> int""" 1890 return _gdal.VSIFTruncateL(*args)
1891
1892 -def VSISupportsSparseFiles(*args):
1893 """VSISupportsSparseFiles(char const * utf8_path) -> int""" 1894 return _gdal.VSISupportsSparseFiles(*args)
1895 VSI_RANGE_STATUS_UNKNOWN = _gdal.VSI_RANGE_STATUS_UNKNOWN 1896 VSI_RANGE_STATUS_DATA = _gdal.VSI_RANGE_STATUS_DATA 1897 VSI_RANGE_STATUS_HOLE = _gdal.VSI_RANGE_STATUS_HOLE 1898
1899 -def VSIFGetRangeStatusL(*args):
1900 """VSIFGetRangeStatusL(VSILFILE fp, GIntBig offset, GIntBig length) -> int""" 1901 return _gdal.VSIFGetRangeStatusL(*args)
1902
1903 -def VSIFWriteL(*args):
1904 """VSIFWriteL(int nLen, int size, int memb, VSILFILE fp) -> int""" 1905 return _gdal.VSIFWriteL(*args)
1906
1907 -def VSICurlClearCache(*args):
1908 """VSICurlClearCache()""" 1909 return _gdal.VSICurlClearCache(*args)
1910
1911 -def VSICurlPartialClearCache(*args):
1912 """VSICurlPartialClearCache(char const * utf8_path)""" 1913 return _gdal.VSICurlPartialClearCache(*args)
1914
1915 -def NetworkStatsReset(*args):
1916 """NetworkStatsReset()""" 1917 return _gdal.NetworkStatsReset(*args)
1918
1919 -def NetworkStatsGetAsSerializedJSON(*args):
1920 """NetworkStatsGetAsSerializedJSON(char ** options=None) -> retStringAndCPLFree *""" 1921 return _gdal.NetworkStatsGetAsSerializedJSON(*args)
1922
1923 -def ParseCommandLine(*args):
1924 """ParseCommandLine(char const * utf8_path) -> char **""" 1925 return _gdal.ParseCommandLine(*args)
1926 -class MajorObject(_object):
1927 """Proxy of C++ GDALMajorObjectShadow class.""" 1928 1929 __swig_setmethods__ = {} 1930 __setattr__ = lambda self, name, value: _swig_setattr(self, MajorObject, name, value) 1931 __swig_getmethods__ = {} 1932 __getattr__ = lambda self, name: _swig_getattr(self, MajorObject, name) 1933
1934 - def __init__(self, *args, **kwargs):
1935 raise AttributeError("No constructor defined")
1936 __repr__ = _swig_repr 1937
1938 - def GetDescription(self, *args):
1939 """GetDescription(MajorObject self) -> char const *""" 1940 return _gdal.MajorObject_GetDescription(self, *args)
1941 1942
1943 - def SetDescription(self, *args):
1944 """SetDescription(MajorObject self, char const * pszNewDesc)""" 1945 return _gdal.MajorObject_SetDescription(self, *args)
1946 1947
1948 - def GetMetadataDomainList(self, *args):
1949 """GetMetadataDomainList(MajorObject self) -> char **""" 1950 return _gdal.MajorObject_GetMetadataDomainList(self, *args)
1951 1952
1953 - def GetMetadata_Dict(self, *args):
1954 """GetMetadata_Dict(MajorObject self, char const * pszDomain) -> char **""" 1955 return _gdal.MajorObject_GetMetadata_Dict(self, *args)
1956 1957
1958 - def GetMetadata_List(self, *args):
1959 """GetMetadata_List(MajorObject self, char const * pszDomain) -> char **""" 1960 return _gdal.MajorObject_GetMetadata_List(self, *args)
1961 1962
1963 - def SetMetadata(self, *args):
1964 """ 1965 SetMetadata(MajorObject self, char ** papszMetadata, char const * pszDomain) -> CPLErr 1966 SetMetadata(MajorObject self, char * pszMetadataString, char const * pszDomain) -> CPLErr 1967 """ 1968 return _gdal.MajorObject_SetMetadata(self, *args)
1969 1970
1971 - def GetMetadataItem(self, *args):
1972 """GetMetadataItem(MajorObject self, char const * pszName, char const * pszDomain) -> char const *""" 1973 return _gdal.MajorObject_GetMetadataItem(self, *args)
1974 1975
1976 - def SetMetadataItem(self, *args):
1977 """SetMetadataItem(MajorObject self, char const * pszName, char const * pszValue, char const * pszDomain) -> CPLErr""" 1978 return _gdal.MajorObject_SetMetadataItem(self, *args)
1979 1980
1981 - def GetMetadata(self, domain=''):
1982 if domain and domain[:4] == 'xml:': 1983 return self.GetMetadata_List(domain) 1984 return self.GetMetadata_Dict(domain)
1985 1986 MajorObject_swigregister = _gdal.MajorObject_swigregister 1987 MajorObject_swigregister(MajorObject) 1988
1989 -class Driver(MajorObject):
1990 """Proxy of C++ GDALDriverShadow class.""" 1991 1992 __swig_setmethods__ = {} 1993 for _s in [MajorObject]: 1994 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) 1995 __setattr__ = lambda self, name, value: _swig_setattr(self, Driver, name, value) 1996 __swig_getmethods__ = {} 1997 for _s in [MajorObject]: 1998 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) 1999 __getattr__ = lambda self, name: _swig_getattr(self, Driver, name) 2000
2001 - def __init__(self, *args, **kwargs):
2002 raise AttributeError("No constructor defined")
2003 __repr__ = _swig_repr 2004 __swig_getmethods__["ShortName"] = _gdal.Driver_ShortName_get 2005 if _newclass: 2006 ShortName = _swig_property(_gdal.Driver_ShortName_get) 2007 __swig_getmethods__["LongName"] = _gdal.Driver_LongName_get 2008 if _newclass: 2009 LongName = _swig_property(_gdal.Driver_LongName_get) 2010 __swig_getmethods__["HelpTopic"] = _gdal.Driver_HelpTopic_get 2011 if _newclass: 2012 HelpTopic = _swig_property(_gdal.Driver_HelpTopic_get) 2013
2014 - def Create(self, *args, **kwargs):
2015 """Create(Driver self, char const * utf8_path, int xsize, int ysize, int bands=1, GDALDataType eType, char ** options=None) -> Dataset""" 2016 return _gdal.Driver_Create(self, *args, **kwargs)
2017 2018
2019 - def CreateMultiDimensional(self, *args, **kwargs):
2020 """CreateMultiDimensional(Driver self, char const * utf8_path, char ** root_group_options=None, char ** options=None) -> Dataset""" 2021 return _gdal.Driver_CreateMultiDimensional(self, *args, **kwargs)
2022 2023
2024 - def CreateCopy(self, *args, **kwargs):
2025 """CreateCopy(Driver self, char const * utf8_path, Dataset src, int strict=1, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 2026 return _gdal.Driver_CreateCopy(self, *args, **kwargs)
2027 2028
2029 - def Delete(self, *args):
2030 """Delete(Driver self, char const * utf8_path) -> CPLErr""" 2031 return _gdal.Driver_Delete(self, *args)
2032 2033
2034 - def Rename(self, *args):
2035 """Rename(Driver self, char const * newName, char const * oldName) -> CPLErr""" 2036 return _gdal.Driver_Rename(self, *args)
2037 2038
2039 - def CopyFiles(self, *args):
2040 """CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr""" 2041 return _gdal.Driver_CopyFiles(self, *args)
2042 2043
2044 - def Register(self, *args):
2045 """Register(Driver self) -> int""" 2046 return _gdal.Driver_Register(self, *args)
2047 2048
2049 - def Deregister(self, *args):
2050 """Deregister(Driver self)""" 2051 return _gdal.Driver_Deregister(self, *args)
2052 2053 Driver_swigregister = _gdal.Driver_swigregister 2054 Driver_swigregister(Driver) 2055 2056 from sys import version_info as _swig_python_version_info 2057 if _swig_python_version_info >= (2, 7, 0): 2058 from . import ogr 2059 else: 2060 import ogr 2061 del _swig_python_version_info 2062 from sys import version_info as _swig_python_version_info 2063 if _swig_python_version_info >= (2, 7, 0): 2064 from . import osr 2065 else: 2066 import osr 2067 del _swig_python_version_info
2068 -class ColorEntry(_object):
2069 """Proxy of C++ GDALColorEntry class.""" 2070 2071 __swig_setmethods__ = {} 2072 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorEntry, name, value) 2073 __swig_getmethods__ = {} 2074 __getattr__ = lambda self, name: _swig_getattr(self, ColorEntry, name) 2075
2076 - def __init__(self, *args, **kwargs):
2077 raise AttributeError("No constructor defined")
2078 __repr__ = _swig_repr 2079 __swig_setmethods__["c1"] = _gdal.ColorEntry_c1_set 2080 __swig_getmethods__["c1"] = _gdal.ColorEntry_c1_get 2081 if _newclass: 2082 c1 = _swig_property(_gdal.ColorEntry_c1_get, _gdal.ColorEntry_c1_set) 2083 __swig_setmethods__["c2"] = _gdal.ColorEntry_c2_set 2084 __swig_getmethods__["c2"] = _gdal.ColorEntry_c2_get 2085 if _newclass: 2086 c2 = _swig_property(_gdal.ColorEntry_c2_get, _gdal.ColorEntry_c2_set) 2087 __swig_setmethods__["c3"] = _gdal.ColorEntry_c3_set 2088 __swig_getmethods__["c3"] = _gdal.ColorEntry_c3_get 2089 if _newclass: 2090 c3 = _swig_property(_gdal.ColorEntry_c3_get, _gdal.ColorEntry_c3_set) 2091 __swig_setmethods__["c4"] = _gdal.ColorEntry_c4_set 2092 __swig_getmethods__["c4"] = _gdal.ColorEntry_c4_get 2093 if _newclass: 2094 c4 = _swig_property(_gdal.ColorEntry_c4_get, _gdal.ColorEntry_c4_set)
2095 ColorEntry_swigregister = _gdal.ColorEntry_swigregister 2096 ColorEntry_swigregister(ColorEntry) 2097
2098 -class GCP(_object):
2099 """Proxy of C++ GDAL_GCP class.""" 2100 2101 __swig_setmethods__ = {} 2102 __setattr__ = lambda self, name, value: _swig_setattr(self, GCP, name, value) 2103 __swig_getmethods__ = {} 2104 __getattr__ = lambda self, name: _swig_getattr(self, GCP, name) 2105 __repr__ = _swig_repr 2106 __swig_setmethods__["GCPX"] = _gdal.GCP_GCPX_set 2107 __swig_getmethods__["GCPX"] = _gdal.GCP_GCPX_get 2108 if _newclass: 2109 GCPX = _swig_property(_gdal.GCP_GCPX_get, _gdal.GCP_GCPX_set) 2110 __swig_setmethods__["GCPY"] = _gdal.GCP_GCPY_set 2111 __swig_getmethods__["GCPY"] = _gdal.GCP_GCPY_get 2112 if _newclass: 2113 GCPY = _swig_property(_gdal.GCP_GCPY_get, _gdal.GCP_GCPY_set) 2114 __swig_setmethods__["GCPZ"] = _gdal.GCP_GCPZ_set 2115 __swig_getmethods__["GCPZ"] = _gdal.GCP_GCPZ_get 2116 if _newclass: 2117 GCPZ = _swig_property(_gdal.GCP_GCPZ_get, _gdal.GCP_GCPZ_set) 2118 __swig_setmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_set 2119 __swig_getmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_get 2120 if _newclass: 2121 GCPPixel = _swig_property(_gdal.GCP_GCPPixel_get, _gdal.GCP_GCPPixel_set) 2122 __swig_setmethods__["GCPLine"] = _gdal.GCP_GCPLine_set 2123 __swig_getmethods__["GCPLine"] = _gdal.GCP_GCPLine_get 2124 if _newclass: 2125 GCPLine = _swig_property(_gdal.GCP_GCPLine_get, _gdal.GCP_GCPLine_set) 2126 __swig_setmethods__["Info"] = _gdal.GCP_Info_set 2127 __swig_getmethods__["Info"] = _gdal.GCP_Info_get 2128 if _newclass: 2129 Info = _swig_property(_gdal.GCP_Info_get, _gdal.GCP_Info_set) 2130 __swig_setmethods__["Id"] = _gdal.GCP_Id_set 2131 __swig_getmethods__["Id"] = _gdal.GCP_Id_get 2132 if _newclass: 2133 Id = _swig_property(_gdal.GCP_Id_get, _gdal.GCP_Id_set) 2134
2135 - def __init__(self, *args):
2136 """__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""" 2137 this = _gdal.new_GCP(*args) 2138 try: 2139 self.this.append(this) 2140 except __builtin__.Exception: 2141 self.this = this
2142 __swig_destroy__ = _gdal.delete_GCP 2143 __del__ = lambda self: None 2144
2145 - def __str__(self):
2146 str = '%s (%.2fP,%.2fL) -> (%.7fE,%.7fN,%.2f) %s '\ 2147 % (self.Id, self.GCPPixel, self.GCPLine, 2148 self.GCPX, self.GCPY, self.GCPZ, self.Info ) 2149 return str
2150
2151 - def serialize(self, with_Z=0):
2152 base = [gdalconst.CXT_Element,'GCP'] 2153 base.append([gdalconst.CXT_Attribute,'Id',[gdalconst.CXT_Text,self.Id]]) 2154 pixval = '%0.15E' % self.GCPPixel 2155 lineval = '%0.15E' % self.GCPLine 2156 xval = '%0.15E' % self.GCPX 2157 yval = '%0.15E' % self.GCPY 2158 zval = '%0.15E' % self.GCPZ 2159 base.append([gdalconst.CXT_Attribute,'Pixel',[gdalconst.CXT_Text,pixval]]) 2160 base.append([gdalconst.CXT_Attribute,'Line',[gdalconst.CXT_Text,lineval]]) 2161 base.append([gdalconst.CXT_Attribute,'X',[gdalconst.CXT_Text,xval]]) 2162 base.append([gdalconst.CXT_Attribute,'Y',[gdalconst.CXT_Text,yval]]) 2163 if with_Z: 2164 base.append([gdalconst.CXT_Attribute,'Z',[gdalconst.CXT_Text,zval]]) 2165 return base
2166 2167 GCP_swigregister = _gdal.GCP_swigregister 2168 GCP_swigregister(GCP) 2169 2170
2171 -def GDAL_GCP_GCPX_get(*args):
2172 """GDAL_GCP_GCPX_get(GCP gcp) -> double""" 2173 return _gdal.GDAL_GCP_GCPX_get(*args)
2174
2175 -def GDAL_GCP_GCPX_set(*args):
2176 """GDAL_GCP_GCPX_set(GCP gcp, double dfGCPX)""" 2177 return _gdal.GDAL_GCP_GCPX_set(*args)
2178
2179 -def GDAL_GCP_GCPY_get(*args):
2180 """GDAL_GCP_GCPY_get(GCP gcp) -> double""" 2181 return _gdal.GDAL_GCP_GCPY_get(*args)
2182
2183 -def GDAL_GCP_GCPY_set(*args):
2184 """GDAL_GCP_GCPY_set(GCP gcp, double dfGCPY)""" 2185 return _gdal.GDAL_GCP_GCPY_set(*args)
2186
2187 -def GDAL_GCP_GCPZ_get(*args):
2188 """GDAL_GCP_GCPZ_get(GCP gcp) -> double""" 2189 return _gdal.GDAL_GCP_GCPZ_get(*args)
2190
2191 -def GDAL_GCP_GCPZ_set(*args):
2192 """GDAL_GCP_GCPZ_set(GCP gcp, double dfGCPZ)""" 2193 return _gdal.GDAL_GCP_GCPZ_set(*args)
2194
2195 -def GDAL_GCP_GCPPixel_get(*args):
2196 """GDAL_GCP_GCPPixel_get(GCP gcp) -> double""" 2197 return _gdal.GDAL_GCP_GCPPixel_get(*args)
2198
2199 -def GDAL_GCP_GCPPixel_set(*args):
2200 """GDAL_GCP_GCPPixel_set(GCP gcp, double dfGCPPixel)""" 2201 return _gdal.GDAL_GCP_GCPPixel_set(*args)
2202
2203 -def GDAL_GCP_GCPLine_get(*args):
2204 """GDAL_GCP_GCPLine_get(GCP gcp) -> double""" 2205 return _gdal.GDAL_GCP_GCPLine_get(*args)
2206
2207 -def GDAL_GCP_GCPLine_set(*args):
2208 """GDAL_GCP_GCPLine_set(GCP gcp, double dfGCPLine)""" 2209 return _gdal.GDAL_GCP_GCPLine_set(*args)
2210
2211 -def GDAL_GCP_Info_get(*args):
2212 """GDAL_GCP_Info_get(GCP gcp) -> char const *""" 2213 return _gdal.GDAL_GCP_Info_get(*args)
2214
2215 -def GDAL_GCP_Info_set(*args):
2216 """GDAL_GCP_Info_set(GCP gcp, char const * pszInfo)""" 2217 return _gdal.GDAL_GCP_Info_set(*args)
2218
2219 -def GDAL_GCP_Id_get(*args):
2220 """GDAL_GCP_Id_get(GCP gcp) -> char const *""" 2221 return _gdal.GDAL_GCP_Id_get(*args)
2222
2223 -def GDAL_GCP_Id_set(*args):
2224 """GDAL_GCP_Id_set(GCP gcp, char const * pszId)""" 2225 return _gdal.GDAL_GCP_Id_set(*args)
2226
2227 -def GCPsToGeoTransform(*args):
2228 """GCPsToGeoTransform(int nGCPs, int bApproxOK=1) -> RETURN_NONE""" 2229 return _gdal.GCPsToGeoTransform(*args)
2230 -class VirtualMem(_object):
2231 """Proxy of C++ CPLVirtualMemShadow class.""" 2232 2233 __swig_setmethods__ = {} 2234 __setattr__ = lambda self, name, value: _swig_setattr(self, VirtualMem, name, value) 2235 __swig_getmethods__ = {} 2236 __getattr__ = lambda self, name: _swig_getattr(self, VirtualMem, name) 2237
2238 - def __init__(self, *args, **kwargs):
2239 raise AttributeError("No constructor defined")
2240 __repr__ = _swig_repr 2241 __swig_destroy__ = _gdal.delete_VirtualMem 2242 __del__ = lambda self: None 2243
2244 - def GetAddr(self, *args):
2245 """GetAddr(VirtualMem self)""" 2246 return _gdal.VirtualMem_GetAddr(self, *args)
2247 2248
2249 - def Pin(self, *args):
2250 """Pin(VirtualMem self, size_t start_offset=0, size_t nsize=0, int bWriteOp=0)""" 2251 return _gdal.VirtualMem_Pin(self, *args)
2252 2253 VirtualMem_swigregister = _gdal.VirtualMem_swigregister 2254 VirtualMem_swigregister(VirtualMem) 2255
2256 -class AsyncReader(_object):
2257 """Proxy of C++ GDALAsyncReaderShadow class.""" 2258 2259 __swig_setmethods__ = {} 2260 __setattr__ = lambda self, name, value: _swig_setattr(self, AsyncReader, name, value) 2261 __swig_getmethods__ = {} 2262 __getattr__ = lambda self, name: _swig_getattr(self, AsyncReader, name) 2263
2264 - def __init__(self, *args, **kwargs):
2265 raise AttributeError("No constructor defined")
2266 __repr__ = _swig_repr 2267 __swig_destroy__ = _gdal.delete_AsyncReader 2268 __del__ = lambda self: None 2269
2270 - def GetNextUpdatedRegion(self, *args):
2271 """GetNextUpdatedRegion(AsyncReader self, double timeout) -> GDALAsyncStatusType""" 2272 return _gdal.AsyncReader_GetNextUpdatedRegion(self, *args)
2273 2274
2275 - def GetBuffer(self, *args):
2276 """GetBuffer(AsyncReader self)""" 2277 return _gdal.AsyncReader_GetBuffer(self, *args)
2278 2279
2280 - def LockBuffer(self, *args):
2281 """LockBuffer(AsyncReader self, double timeout) -> int""" 2282 return _gdal.AsyncReader_LockBuffer(self, *args)
2283 2284
2285 - def UnlockBuffer(self, *args):
2286 """UnlockBuffer(AsyncReader self)""" 2287 return _gdal.AsyncReader_UnlockBuffer(self, *args)
2288 2289 AsyncReader_swigregister = _gdal.AsyncReader_swigregister 2290 AsyncReader_swigregister(AsyncReader) 2291
2292 -class Dataset(MajorObject):
2293 """Proxy of C++ GDALDatasetShadow class.""" 2294 2295 __swig_setmethods__ = {} 2296 for _s in [MajorObject]: 2297 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) 2298 __setattr__ = lambda self, name, value: _swig_setattr(self, Dataset, name, value) 2299 __swig_getmethods__ = {} 2300 for _s in [MajorObject]: 2301 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) 2302 __getattr__ = lambda self, name: _swig_getattr(self, Dataset, name) 2303
2304 - def __init__(self, *args, **kwargs):
2305 raise AttributeError("No constructor defined")
2306 __repr__ = _swig_repr 2307 __swig_getmethods__["RasterXSize"] = _gdal.Dataset_RasterXSize_get 2308 if _newclass: 2309 RasterXSize = _swig_property(_gdal.Dataset_RasterXSize_get) 2310 __swig_getmethods__["RasterYSize"] = _gdal.Dataset_RasterYSize_get 2311 if _newclass: 2312 RasterYSize = _swig_property(_gdal.Dataset_RasterYSize_get) 2313 __swig_getmethods__["RasterCount"] = _gdal.Dataset_RasterCount_get 2314 if _newclass: 2315 RasterCount = _swig_property(_gdal.Dataset_RasterCount_get) 2316 __swig_destroy__ = _gdal.delete_Dataset 2317 __del__ = lambda self: None 2318
2319 - def GetDriver(self, *args):
2320 """GetDriver(Dataset self) -> Driver""" 2321 return _gdal.Dataset_GetDriver(self, *args)
2322 2323
2324 - def GetRasterBand(self, *args):
2325 """GetRasterBand(Dataset self, int nBand) -> Band""" 2326 return _gdal.Dataset_GetRasterBand(self, *args)
2327 2328
2329 - def GetRootGroup(self, *args):
2330 """GetRootGroup(Dataset self) -> Group""" 2331 return _gdal.Dataset_GetRootGroup(self, *args)
2332 2333
2334 - def GetProjection(self, *args):
2335 """GetProjection(Dataset self) -> char const *""" 2336 return _gdal.Dataset_GetProjection(self, *args)
2337 2338
2339 - def GetProjectionRef(self, *args):
2340 """GetProjectionRef(Dataset self) -> char const *""" 2341 return _gdal.Dataset_GetProjectionRef(self, *args)
2342 2343
2344 - def GetSpatialRef(self, *args):
2345 """GetSpatialRef(Dataset self) -> SpatialReference""" 2346 return _gdal.Dataset_GetSpatialRef(self, *args)
2347 2348
2349 - def SetProjection(self, *args):
2350 """SetProjection(Dataset self, char const * prj) -> CPLErr""" 2351 return _gdal.Dataset_SetProjection(self, *args)
2352 2353
2354 - def SetSpatialRef(self, *args):
2355 """SetSpatialRef(Dataset self, SpatialReference srs) -> CPLErr""" 2356 return _gdal.Dataset_SetSpatialRef(self, *args)
2357 2358
2359 - def GetGeoTransform(self, *args, **kwargs):
2360 """GetGeoTransform(Dataset self, int * can_return_null=None)""" 2361 return _gdal.Dataset_GetGeoTransform(self, *args, **kwargs)
2362 2363
2364 - def SetGeoTransform(self, *args):
2365 """SetGeoTransform(Dataset self, double [6] argin) -> CPLErr""" 2366 return _gdal.Dataset_SetGeoTransform(self, *args)
2367 2368
2369 - def BuildOverviews(self, *args, **kwargs):
2370 """BuildOverviews(Dataset self, char const * resampling, int overviewlist=0, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 2371 return _gdal.Dataset_BuildOverviews(self, *args, **kwargs)
2372 2373
2374 - def GetGCPCount(self, *args):
2375 """GetGCPCount(Dataset self) -> int""" 2376 return _gdal.Dataset_GetGCPCount(self, *args)
2377 2378
2379 - def GetGCPProjection(self, *args):
2380 """GetGCPProjection(Dataset self) -> char const *""" 2381 return _gdal.Dataset_GetGCPProjection(self, *args)
2382 2383
2384 - def GetGCPSpatialRef(self, *args):
2385 """GetGCPSpatialRef(Dataset self) -> SpatialReference""" 2386 return _gdal.Dataset_GetGCPSpatialRef(self, *args)
2387 2388
2389 - def GetGCPs(self, *args):
2390 """GetGCPs(Dataset self)""" 2391 return _gdal.Dataset_GetGCPs(self, *args)
2392 2393
2394 - def _SetGCPs(self, *args):
2395 """_SetGCPs(Dataset self, int nGCPs, char const * pszGCPProjection) -> CPLErr""" 2396 return _gdal.Dataset__SetGCPs(self, *args)
2397 2398
2399 - def _SetGCPs2(self, *args):
2400 """_SetGCPs2(Dataset self, int nGCPs, SpatialReference hSRS) -> CPLErr""" 2401 return _gdal.Dataset__SetGCPs2(self, *args)
2402 2403
2404 - def FlushCache(self, *args):
2405 """FlushCache(Dataset self)""" 2406 return _gdal.Dataset_FlushCache(self, *args)
2407 2408
2409 - def AddBand(self, *args, **kwargs):
2410 """AddBand(Dataset self, GDALDataType datatype, char ** options=None) -> CPLErr""" 2411 return _gdal.Dataset_AddBand(self, *args, **kwargs)
2412 2413
2414 - def CreateMaskBand(self, *args):
2415 """CreateMaskBand(Dataset self, int nFlags) -> CPLErr""" 2416 return _gdal.Dataset_CreateMaskBand(self, *args)
2417 2418
2419 - def GetFileList(self, *args):
2420 """GetFileList(Dataset self) -> char **""" 2421 return _gdal.Dataset_GetFileList(self, *args)
2422 2423
2424 - def WriteRaster(self, *args, **kwargs):
2425 """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""" 2426 return _gdal.Dataset_WriteRaster(self, *args, **kwargs)
2427 2428
2429 - def AdviseRead(self, *args):
2430 """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""" 2431 return _gdal.Dataset_AdviseRead(self, *args)
2432 2433
2434 - def BeginAsyncReader(self, *args, **kwargs):
2435 """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""" 2436 return _gdal.Dataset_BeginAsyncReader(self, *args, **kwargs)
2437 2438
2439 - def EndAsyncReader(self, *args):
2440 """EndAsyncReader(Dataset self, AsyncReader ario)""" 2441 return _gdal.Dataset_EndAsyncReader(self, *args)
2442 2443
2444 - def GetVirtualMem(self, *args, **kwargs):
2445 """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""" 2446 return _gdal.Dataset_GetVirtualMem(self, *args, **kwargs)
2447 2448
2449 - def GetTiledVirtualMem(self, *args, **kwargs):
2450 """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""" 2451 return _gdal.Dataset_GetTiledVirtualMem(self, *args, **kwargs)
2452 2453
2454 - def CreateLayer(self, *args, **kwargs):
2455 """CreateLayer(Dataset self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type, char ** options=None) -> Layer""" 2456 return _gdal.Dataset_CreateLayer(self, *args, **kwargs)
2457 2458
2459 - def CopyLayer(self, *args, **kwargs):
2460 """CopyLayer(Dataset self, Layer src_layer, char const * new_name, char ** options=None) -> Layer""" 2461 return _gdal.Dataset_CopyLayer(self, *args, **kwargs)
2462 2463
2464 - def DeleteLayer(self, *args):
2465 """DeleteLayer(Dataset self, int index) -> OGRErr""" 2466 return _gdal.Dataset_DeleteLayer(self, *args)
2467 2468
2469 - def GetLayerCount(self, *args):
2470 """GetLayerCount(Dataset self) -> int""" 2471 return _gdal.Dataset_GetLayerCount(self, *args)
2472 2473
2474 - def IsLayerPrivate(self, *args):
2475 """IsLayerPrivate(Dataset self, int index) -> bool""" 2476 return _gdal.Dataset_IsLayerPrivate(self, *args)
2477 2478
2479 - def GetLayerByIndex(self, *args):
2480 """GetLayerByIndex(Dataset self, int index=0) -> Layer""" 2481 return _gdal.Dataset_GetLayerByIndex(self, *args)
2482 2483
2484 - def GetLayerByName(self, *args):
2485 """GetLayerByName(Dataset self, char const * layer_name) -> Layer""" 2486 return _gdal.Dataset_GetLayerByName(self, *args)
2487 2488
2489 - def ResetReading(self, *args):
2490 """ResetReading(Dataset self)""" 2491 return _gdal.Dataset_ResetReading(self, *args)
2492 2493
2494 - def GetNextFeature(self, *args, **kwargs):
2495 """GetNextFeature(Dataset self, bool include_layer=True, bool include_pct=False, GDALProgressFunc callback=0, void * callback_data=None) -> Feature""" 2496 return _gdal.Dataset_GetNextFeature(self, *args, **kwargs)
2497 2498
2499 - def TestCapability(self, *args):
2500 """TestCapability(Dataset self, char const * cap) -> bool""" 2501 return _gdal.Dataset_TestCapability(self, *args)
2502 2503
2504 - def ExecuteSQL(self, *args, **kwargs):
2505 """ExecuteSQL(Dataset self, char const * statement, Geometry spatialFilter=None, char const * dialect) -> Layer""" 2506 return _gdal.Dataset_ExecuteSQL(self, *args, **kwargs)
2507 2508
2509 - def ReleaseResultSet(self, *args):
2510 """ReleaseResultSet(Dataset self, Layer layer)""" 2511 return _gdal.Dataset_ReleaseResultSet(self, *args)
2512 2513
2514 - def GetStyleTable(self, *args):
2515 """GetStyleTable(Dataset self) -> StyleTable""" 2516 return _gdal.Dataset_GetStyleTable(self, *args)
2517 2518
2519 - def SetStyleTable(self, *args):
2520 """SetStyleTable(Dataset self, StyleTable table)""" 2521 return _gdal.Dataset_SetStyleTable(self, *args)
2522 2523
2524 - def AbortSQL(self, *args):
2525 """AbortSQL(Dataset self) -> OGRErr""" 2526 return _gdal.Dataset_AbortSQL(self, *args)
2527 2528
2529 - def StartTransaction(self, *args, **kwargs):
2530 """StartTransaction(Dataset self, int force=False) -> OGRErr""" 2531 return _gdal.Dataset_StartTransaction(self, *args, **kwargs)
2532 2533
2534 - def CommitTransaction(self, *args):
2535 """CommitTransaction(Dataset self) -> OGRErr""" 2536 return _gdal.Dataset_CommitTransaction(self, *args)
2537 2538
2539 - def RollbackTransaction(self, *args):
2540 """RollbackTransaction(Dataset self) -> OGRErr""" 2541 return _gdal.Dataset_RollbackTransaction(self, *args)
2542 2543
2544 - def ClearStatistics(self, *args):
2545 """ClearStatistics(Dataset self)""" 2546 return _gdal.Dataset_ClearStatistics(self, *args)
2547 2548
2549 - def GetFieldDomainNames(self, *args):
2550 """GetFieldDomainNames(Dataset self, char ** options=None) -> char **""" 2551 return _gdal.Dataset_GetFieldDomainNames(self, *args)
2552 2553
2554 - def GetFieldDomain(self, *args):
2555 """GetFieldDomain(Dataset self, char const * name) -> FieldDomain""" 2556 return _gdal.Dataset_GetFieldDomain(self, *args)
2557 2558
2559 - def AddFieldDomain(self, *args):
2560 """AddFieldDomain(Dataset self, FieldDomain fieldDomain) -> bool""" 2561 return _gdal.Dataset_AddFieldDomain(self, *args)
2562 2563
2564 - def DeleteFieldDomain(self, *args):
2565 """DeleteFieldDomain(Dataset self, char const * name) -> bool""" 2566 return _gdal.Dataset_DeleteFieldDomain(self, *args)
2567 2568
2569 - def UpdateFieldDomain(self, *args):
2570 """UpdateFieldDomain(Dataset self, FieldDomain fieldDomain) -> bool""" 2571 return _gdal.Dataset_UpdateFieldDomain(self, *args)
2572 2573
2574 - def ReadRaster1(self, *args, **kwargs):
2575 """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""" 2576 return _gdal.Dataset_ReadRaster1(self, *args, **kwargs)
2577 2578 2579
2580 - def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None, buf_obj=None, 2581 buf_xsize=None, buf_ysize=None, buf_type=None, 2582 resample_alg=gdalconst.GRIORA_NearestNeighbour, 2583 callback=None, 2584 callback_data=None, 2585 interleave='band', 2586 band_list=None):
2587 """ Reading a chunk of a GDAL band into a numpy array. The optional (buf_xsize,buf_ysize,buf_type) 2588 parameters should generally not be specified if buf_obj is specified. The array is returned""" 2589 2590 from osgeo import gdal_array 2591 return gdal_array.DatasetReadAsArray(self, xoff, yoff, xsize, ysize, buf_obj, 2592 buf_xsize, buf_ysize, buf_type, 2593 resample_alg=resample_alg, 2594 callback=callback, 2595 callback_data=callback_data, 2596 interleave=interleave, 2597 band_list=band_list)
2598
2599 - def WriteArray(self, array, xoff=0, yoff=0, 2600 band_list=None, 2601 interleave='band', 2602 resample_alg=gdalconst.GRIORA_NearestNeighbour, 2603 callback=None, 2604 callback_data=None):
2605 from osgeo import gdal_array 2606 2607 return gdal_array.DatasetWriteArray(self, array, xoff, yoff, 2608 band_list=band_list, 2609 interleave=interleave, 2610 resample_alg=resample_alg, 2611 callback=callback, 2612 callback_data=callback_data)
2613
2614 - def WriteRaster(self, xoff, yoff, xsize, ysize, 2615 buf_string, 2616 buf_xsize=None, buf_ysize=None, buf_type=None, 2617 band_list=None, 2618 buf_pixel_space=None, buf_line_space=None, buf_band_space=None ):
2619 2620 if buf_xsize is None: 2621 buf_xsize = xsize 2622 if buf_ysize is None: 2623 buf_ysize = ysize 2624 if band_list is None: 2625 band_list = list(range(1, self.RasterCount + 1)) 2626 2627 # Redirect to numpy-friendly WriteArray() if buf_string is a numpy array 2628 # and other arguments are compatible 2629 if type(buf_string).__name__ == 'ndarray' and \ 2630 buf_xsize == xsize and buf_ysize == ysize and buf_type is None and \ 2631 buf_pixel_space is None and buf_line_space is None and buf_band_space is None: 2632 return self.WriteArray(buf_string, xoff=xoff, yoff=yoff, 2633 band_list=band_list) 2634 if buf_type is None: 2635 buf_type = self.GetRasterBand(1).DataType 2636 2637 return _gdal.Dataset_WriteRaster(self, 2638 xoff, yoff, xsize, ysize, 2639 buf_string, buf_xsize, buf_ysize, buf_type, band_list, 2640 buf_pixel_space, buf_line_space, buf_band_space )
2641
2642 - def ReadRaster(self, xoff=0, yoff=0, xsize=None, ysize=None, 2643 buf_xsize=None, buf_ysize=None, buf_type=None, 2644 band_list=None, 2645 buf_pixel_space=None, buf_line_space=None, buf_band_space=None, 2646 resample_alg=gdalconst.GRIORA_NearestNeighbour, 2647 callback=None, 2648 callback_data=None, 2649 buf_obj=None):
2650 2651 if xsize is None: 2652 xsize = self.RasterXSize 2653 if ysize is None: 2654 ysize = self.RasterYSize 2655 if band_list is None: 2656 band_list = list(range(1, self.RasterCount + 1)) 2657 if buf_xsize is None: 2658 buf_xsize = xsize 2659 if buf_ysize is None: 2660 buf_ysize = ysize 2661 2662 if buf_type is None: 2663 buf_type = self.GetRasterBand(1).DataType; 2664 2665 return _gdal.Dataset_ReadRaster1(self, xoff, yoff, xsize, ysize, 2666 buf_xsize, buf_ysize, buf_type, 2667 band_list, buf_pixel_space, buf_line_space, buf_band_space, 2668 resample_alg, callback, callback_data, buf_obj )
2669
2670 - def GetVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0, 2671 xsize=None, ysize=None, bufxsize=None, bufysize=None, 2672 datatype=None, band_list=None, band_sequential = True, 2673 cache_size = 10 * 1024 * 1024, page_size_hint = 0, 2674 options=None):
2675 """Return a NumPy array for the dataset, seen as a virtual memory mapping. 2676 If there are several bands and band_sequential = True, an element is 2677 accessed with array[band][y][x]. 2678 If there are several bands and band_sequential = False, an element is 2679 accessed with array[y][x][band]. 2680 If there is only one band, an element is accessed with array[y][x]. 2681 Any reference to the array must be dropped before the last reference to the 2682 related dataset is also dropped. 2683 """ 2684 from osgeo import gdal_array 2685 if xsize is None: 2686 xsize = self.RasterXSize 2687 if ysize is None: 2688 ysize = self.RasterYSize 2689 if bufxsize is None: 2690 bufxsize = self.RasterXSize 2691 if bufysize is None: 2692 bufysize = self.RasterYSize 2693 if datatype is None: 2694 datatype = self.GetRasterBand(1).DataType 2695 if band_list is None: 2696 band_list = list(range(1, self.RasterCount + 1)) 2697 if options is None: 2698 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, band_list, band_sequential, cache_size, page_size_hint) 2699 else: 2700 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, band_list, band_sequential, cache_size, page_size_hint, options) 2701 return gdal_array.VirtualMemGetArray( virtualmem )
2702
2703 - def GetTiledVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0, 2704 xsize=None, ysize=None, tilexsize=256, tileysize=256, 2705 datatype=None, band_list=None, tile_organization=gdalconst.GTO_BSQ, 2706 cache_size = 10 * 1024 * 1024, options=None):
2707 """Return a NumPy array for the dataset, seen as a virtual memory mapping with 2708 a tile organization. 2709 If there are several bands and tile_organization = gdal.GTO_TIP, an element is 2710 accessed with array[tiley][tilex][y][x][band]. 2711 If there are several bands and tile_organization = gdal.GTO_BIT, an element is 2712 accessed with array[tiley][tilex][band][y][x]. 2713 If there are several bands and tile_organization = gdal.GTO_BSQ, an element is 2714 accessed with array[band][tiley][tilex][y][x]. 2715 If there is only one band, an element is accessed with array[tiley][tilex][y][x]. 2716 Any reference to the array must be dropped before the last reference to the 2717 related dataset is also dropped. 2718 """ 2719 from osgeo import gdal_array 2720 if xsize is None: 2721 xsize = self.RasterXSize 2722 if ysize is None: 2723 ysize = self.RasterYSize 2724 if datatype is None: 2725 datatype = self.GetRasterBand(1).DataType 2726 if band_list is None: 2727 band_list = list(range(1, self.RasterCount + 1)) 2728 if options is None: 2729 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,band_list,tile_organization,cache_size) 2730 else: 2731 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,band_list,tile_organization,cache_size, options) 2732 return gdal_array.VirtualMemGetArray( virtualmem )
2733
2734 - def GetSubDatasets(self):
2735 sd_list = [] 2736 2737 sd = self.GetMetadata('SUBDATASETS') 2738 if sd is None: 2739 return sd_list 2740 2741 i = 1 2742 while 'SUBDATASET_'+str(i)+'_NAME' in sd: 2743 sd_list.append((sd['SUBDATASET_'+str(i)+'_NAME'], 2744 sd['SUBDATASET_'+str(i)+'_DESC'])) 2745 i = i + 1 2746 return sd_list
2747
2748 - def BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj=None, buf_xsize=None, buf_ysize=None, buf_type=None, band_list=None, options=None):
2749 if band_list is None: 2750 band_list = list(range(1, self.RasterCount + 1)) 2751 if buf_xsize is None: 2752 buf_xsize = 0; 2753 if buf_ysize is None: 2754 buf_ysize = 0; 2755 if buf_type is None: 2756 buf_type = gdalconst.GDT_Byte 2757 2758 if buf_xsize <= 0: 2759 buf_xsize = xsize 2760 if buf_ysize <= 0: 2761 buf_ysize = ysize 2762 options = [] if options is None else options 2763 2764 if buf_obj is None: 2765 from sys import version_info 2766 nRequiredSize = int(buf_xsize * buf_ysize * len(band_list) * (_gdal.GetDataTypeSize(buf_type) / 8)) 2767 if version_info >= (3, 0, 0): 2768 buf_obj_ar = [None] 2769 exec("buf_obj_ar[0] = b' ' * nRequiredSize") 2770 buf_obj = buf_obj_ar[0] 2771 else: 2772 buf_obj = ' ' * nRequiredSize 2773 return _gdal.Dataset_BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj, buf_xsize, buf_ysize, buf_type, band_list, 0, 0, 0, options)
2774
2775 - def GetLayer(self, iLayer=0):
2776 """Return the layer given an index or a name""" 2777 if isinstance(iLayer, str): 2778 return self.GetLayerByName(str(iLayer)) 2779 elif isinstance(iLayer, int): 2780 return self.GetLayerByIndex(iLayer) 2781 else: 2782 raise TypeError("Input %s is not of String or Int type" % type(iLayer))
2783
2784 - def DeleteLayer(self, value):
2785 """Deletes the layer given an index or layer name""" 2786 if isinstance(value, str): 2787 for i in range(self.GetLayerCount()): 2788 name = self.GetLayer(i).GetName() 2789 if name == value: 2790 return _gdal.Dataset_DeleteLayer(self, i) 2791 raise ValueError("Layer %s not found to delete" % value) 2792 elif isinstance(value, int): 2793 return _gdal.Dataset_DeleteLayer(self, value) 2794 else: 2795 raise TypeError("Input %s is not of String or Int type" % type(value))
2796
2797 - def SetGCPs(self, gcps, wkt_or_spatial_ref):
2798 if isinstance(wkt_or_spatial_ref, str): 2799 return self._SetGCPs(gcps, wkt_or_spatial_ref) 2800 else: 2801 return self._SetGCPs2(gcps, wkt_or_spatial_ref)
2802 2803 Dataset_swigregister = _gdal.Dataset_swigregister 2804 Dataset_swigregister(Dataset) 2805 2806 GEDTST_NONE = _gdal.GEDTST_NONE 2807 GEDTST_JSON = _gdal.GEDTST_JSON
2808 -class Group(_object):
2809 """Proxy of C++ GDALGroupHS class.""" 2810 2811 __swig_setmethods__ = {} 2812 __setattr__ = lambda self, name, value: _swig_setattr(self, Group, name, value) 2813 __swig_getmethods__ = {} 2814 __getattr__ = lambda self, name: _swig_getattr(self, Group, name) 2815
2816 - def __init__(self, *args, **kwargs):
2817 raise AttributeError("No constructor defined")
2818 __repr__ = _swig_repr 2819 __swig_destroy__ = _gdal.delete_Group 2820 __del__ = lambda self: None 2821
2822 - def GetName(self, *args):
2823 """GetName(Group self) -> char const *""" 2824 return _gdal.Group_GetName(self, *args)
2825 2826
2827 - def GetFullName(self, *args):
2828 """GetFullName(Group self) -> char const *""" 2829 return _gdal.Group_GetFullName(self, *args)
2830 2831
2832 - def GetMDArrayNames(self, *args):
2833 """GetMDArrayNames(Group self, char ** options=None) -> char **""" 2834 return _gdal.Group_GetMDArrayNames(self, *args)
2835 2836
2837 - def OpenMDArray(self, *args):
2838 """OpenMDArray(Group self, char const * name, char ** options=None) -> MDArray""" 2839 return _gdal.Group_OpenMDArray(self, *args)
2840 2841
2842 - def OpenMDArrayFromFullname(self, *args):
2843 """OpenMDArrayFromFullname(Group self, char const * name, char ** options=None) -> MDArray""" 2844 return _gdal.Group_OpenMDArrayFromFullname(self, *args)
2845 2846
2847 - def ResolveMDArray(self, *args):
2848 """ResolveMDArray(Group self, char const * name, char const * starting_point, char ** options=None) -> MDArray""" 2849 return _gdal.Group_ResolveMDArray(self, *args)
2850 2851
2852 - def GetGroupNames(self, *args):
2853 """GetGroupNames(Group self, char ** options=None) -> char **""" 2854 return _gdal.Group_GetGroupNames(self, *args)
2855 2856
2857 - def OpenGroup(self, *args):
2858 """OpenGroup(Group self, char const * name, char ** options=None) -> Group""" 2859 return _gdal.Group_OpenGroup(self, *args)
2860 2861
2862 - def OpenGroupFromFullname(self, *args):
2863 """OpenGroupFromFullname(Group self, char const * name, char ** options=None) -> Group""" 2864 return _gdal.Group_OpenGroupFromFullname(self, *args)
2865 2866
2867 - def GetVectorLayerNames(self, *args):
2868 """GetVectorLayerNames(Group self, char ** options=None) -> char **""" 2869 return _gdal.Group_GetVectorLayerNames(self, *args)
2870 2871
2872 - def OpenVectorLayer(self, *args):
2873 """OpenVectorLayer(Group self, char const * name, char ** options=None) -> Layer""" 2874 return _gdal.Group_OpenVectorLayer(self, *args)
2875 2876
2877 - def GetDimensions(self, *args):
2878 """GetDimensions(Group self, char ** options=None)""" 2879 return _gdal.Group_GetDimensions(self, *args)
2880 2881
2882 - def GetAttribute(self, *args):
2883 """GetAttribute(Group self, char const * name) -> Attribute""" 2884 return _gdal.Group_GetAttribute(self, *args)
2885 2886
2887 - def GetAttributes(self, *args):
2888 """GetAttributes(Group self, char ** options=None)""" 2889 return _gdal.Group_GetAttributes(self, *args)
2890 2891
2892 - def GetStructuralInfo(self, *args):
2893 """GetStructuralInfo(Group self) -> char **""" 2894 return _gdal.Group_GetStructuralInfo(self, *args)
2895 2896
2897 - def CreateGroup(self, *args):
2898 """CreateGroup(Group self, char const * name, char ** options=None) -> Group""" 2899 return _gdal.Group_CreateGroup(self, *args)
2900 2901
2902 - def CreateDimension(self, *args):
2903 """CreateDimension(Group self, char const * name, char const * type, char const * direction, unsigned long long size, char ** options=None) -> Dimension""" 2904 return _gdal.Group_CreateDimension(self, *args)
2905 2906
2907 - def CreateMDArray(self, *args):
2908 """CreateMDArray(Group self, char const * name, int nDimensions, ExtendedDataType data_type, char ** options=None) -> MDArray""" 2909 return _gdal.Group_CreateMDArray(self, *args)
2910 2911
2912 - def CreateAttribute(self, *args):
2913 """CreateAttribute(Group self, char const * name, int nDimensions, ExtendedDataType data_type, char ** options=None) -> Attribute""" 2914 return _gdal.Group_CreateAttribute(self, *args)
2915 2916 Group_swigregister = _gdal.Group_swigregister 2917 Group_swigregister(Group) 2918
2919 -class Statistics(_object):
2920 """Proxy of C++ Statistics class.""" 2921 2922 __swig_setmethods__ = {} 2923 __setattr__ = lambda self, name, value: _swig_setattr(self, Statistics, name, value) 2924 __swig_getmethods__ = {} 2925 __getattr__ = lambda self, name: _swig_getattr(self, Statistics, name) 2926 __repr__ = _swig_repr 2927 __swig_getmethods__["min"] = _gdal.Statistics_min_get 2928 if _newclass: 2929 min = _swig_property(_gdal.Statistics_min_get) 2930 __swig_getmethods__["max"] = _gdal.Statistics_max_get 2931 if _newclass: 2932 max = _swig_property(_gdal.Statistics_max_get) 2933 __swig_getmethods__["mean"] = _gdal.Statistics_mean_get 2934 if _newclass: 2935 mean = _swig_property(_gdal.Statistics_mean_get) 2936 __swig_getmethods__["std_dev"] = _gdal.Statistics_std_dev_get 2937 if _newclass: 2938 std_dev = _swig_property(_gdal.Statistics_std_dev_get) 2939 __swig_getmethods__["valid_count"] = _gdal.Statistics_valid_count_get 2940 if _newclass: 2941 valid_count = _swig_property(_gdal.Statistics_valid_count_get) 2942 __swig_destroy__ = _gdal.delete_Statistics 2943 __del__ = lambda self: None 2944
2945 - def __init__(self, *args):
2946 """__init__(Statistics self) -> Statistics""" 2947 this = _gdal.new_Statistics(*args) 2948 try: 2949 self.this.append(this) 2950 except __builtin__.Exception: 2951 self.this = this
2952 Statistics_swigregister = _gdal.Statistics_swigregister 2953 Statistics_swigregister(Statistics) 2954
2955 -class MDArray(_object):
2956 """Proxy of C++ GDALMDArrayHS class.""" 2957 2958 __swig_setmethods__ = {} 2959 __setattr__ = lambda self, name, value: _swig_setattr(self, MDArray, name, value) 2960 __swig_getmethods__ = {} 2961 __getattr__ = lambda self, name: _swig_getattr(self, MDArray, name) 2962
2963 - def __init__(self, *args, **kwargs):
2964 raise AttributeError("No constructor defined")
2965 __repr__ = _swig_repr 2966 __swig_destroy__ = _gdal.delete_MDArray 2967 __del__ = lambda self: None 2968
2969 - def GetName(self, *args):
2970 """GetName(MDArray self) -> char const *""" 2971 return _gdal.MDArray_GetName(self, *args)
2972 2973
2974 - def GetFullName(self, *args):
2975 """GetFullName(MDArray self) -> char const *""" 2976 return _gdal.MDArray_GetFullName(self, *args)
2977 2978
2979 - def GetTotalElementsCount(self, *args):
2980 """GetTotalElementsCount(MDArray self) -> unsigned long long""" 2981 return _gdal.MDArray_GetTotalElementsCount(self, *args)
2982 2983
2984 - def GetDimensionCount(self, *args):
2985 """GetDimensionCount(MDArray self) -> size_t""" 2986 return _gdal.MDArray_GetDimensionCount(self, *args)
2987 2988
2989 - def GetDimensions(self, *args):
2990 """GetDimensions(MDArray self)""" 2991 return _gdal.MDArray_GetDimensions(self, *args)
2992 2993
2994 - def GetCoordinateVariables(self, *args):
2995 """GetCoordinateVariables(MDArray self)""" 2996 return _gdal.MDArray_GetCoordinateVariables(self, *args)
2997 2998
2999 - def GetBlockSize(self, *args):
3000 """GetBlockSize(MDArray self)""" 3001 return _gdal.MDArray_GetBlockSize(self, *args)
3002 3003
3004 - def GetProcessingChunkSize(self, *args):
3005 """GetProcessingChunkSize(MDArray self, size_t nMaxChunkMemory)""" 3006 return _gdal.MDArray_GetProcessingChunkSize(self, *args)
3007 3008
3009 - def GetDataType(self, *args):
3010 """GetDataType(MDArray self) -> ExtendedDataType""" 3011 return _gdal.MDArray_GetDataType(self, *args)
3012 3013
3014 - def GetStructuralInfo(self, *args):
3015 """GetStructuralInfo(MDArray self) -> char **""" 3016 return _gdal.MDArray_GetStructuralInfo(self, *args)
3017 3018
3019 - def Read(self, *args):
3020 """Read(MDArray self, int nDims1, int nDims2, int nDims3, int nDims4, ExtendedDataType buffer_datatype) -> CPLErr""" 3021 return _gdal.MDArray_Read(self, *args)
3022 3023
3024 - def WriteStringArray(self, *args):
3025 """WriteStringArray(MDArray self, int nDims1, int nDims2, int nDims3, ExtendedDataType buffer_datatype, char ** options) -> CPLErr""" 3026 return _gdal.MDArray_WriteStringArray(self, *args)
3027 3028
3029 - def Write(self, *args):
3030 """Write(MDArray self, int nDims1, int nDims2, int nDims3, int nDims4, ExtendedDataType buffer_datatype, GIntBig buf_len) -> CPLErr""" 3031 return _gdal.MDArray_Write(self, *args)
3032 3033
3034 - def AdviseRead(self, *args):
3035 """AdviseRead(MDArray self, int nDims1, int nDims2, char ** options=None) -> CPLErr""" 3036 return _gdal.MDArray_AdviseRead(self, *args)
3037 3038
3039 - def GetAttribute(self, *args):
3040 """GetAttribute(MDArray self, char const * name) -> Attribute""" 3041 return _gdal.MDArray_GetAttribute(self, *args)
3042 3043
3044 - def GetAttributes(self, *args):
3045 """GetAttributes(MDArray self, char ** options=None)""" 3046 return _gdal.MDArray_GetAttributes(self, *args)
3047 3048
3049 - def CreateAttribute(self, *args):
3050 """CreateAttribute(MDArray self, char const * name, int nDimensions, ExtendedDataType data_type, char ** options=None) -> Attribute""" 3051 return _gdal.MDArray_CreateAttribute(self, *args)
3052 3053
3054 - def GetNoDataValueAsRaw(self, *args):
3055 """GetNoDataValueAsRaw(MDArray self) -> CPLErr""" 3056 return _gdal.MDArray_GetNoDataValueAsRaw(self, *args)
3057 3058
3059 - def GetNoDataValueAsDouble(self, *args):
3060 """GetNoDataValueAsDouble(MDArray self)""" 3061 return _gdal.MDArray_GetNoDataValueAsDouble(self, *args)
3062 3063
3064 - def GetNoDataValueAsInt64(self, *args):
3065 """GetNoDataValueAsInt64(MDArray self)""" 3066 return _gdal.MDArray_GetNoDataValueAsInt64(self, *args)
3067 3068
3069 - def GetNoDataValueAsUInt64(self, *args):
3070 """GetNoDataValueAsUInt64(MDArray self)""" 3071 return _gdal.MDArray_GetNoDataValueAsUInt64(self, *args)
3072 3073
3074 - def GetNoDataValueAsString(self, *args):
3075 """GetNoDataValueAsString(MDArray self) -> retStringAndCPLFree *""" 3076 return _gdal.MDArray_GetNoDataValueAsString(self, *args)
3077 3078
3079 - def SetNoDataValueDouble(self, *args):
3080 """SetNoDataValueDouble(MDArray self, double d) -> CPLErr""" 3081 return _gdal.MDArray_SetNoDataValueDouble(self, *args)
3082 3083
3084 - def SetNoDataValueInt64(self, *args):
3085 """SetNoDataValueInt64(MDArray self, GIntBig v) -> CPLErr""" 3086 return _gdal.MDArray_SetNoDataValueInt64(self, *args)
3087 3088
3089 - def SetNoDataValueUInt64(self, *args):
3090 """SetNoDataValueUInt64(MDArray self, GUIntBig v) -> CPLErr""" 3091 return _gdal.MDArray_SetNoDataValueUInt64(self, *args)
3092 3093
3094 - def SetNoDataValueString(self, *args):
3095 """SetNoDataValueString(MDArray self, char const * nodata) -> CPLErr""" 3096 return _gdal.MDArray_SetNoDataValueString(self, *args)
3097 3098
3099 - def SetNoDataValueRaw(self, *args):
3100 """SetNoDataValueRaw(MDArray self, GIntBig nLen) -> CPLErr""" 3101 return _gdal.MDArray_SetNoDataValueRaw(self, *args)
3102 3103
3104 - def DeleteNoDataValue(self, *args):
3105 """DeleteNoDataValue(MDArray self) -> CPLErr""" 3106 return _gdal.MDArray_DeleteNoDataValue(self, *args)
3107 3108
3109 - def GetOffset(self, *args):
3110 """GetOffset(MDArray self)""" 3111 return _gdal.MDArray_GetOffset(self, *args)
3112 3113
3114 - def GetOffsetStorageType(self, *args):
3115 """GetOffsetStorageType(MDArray self) -> GDALDataType""" 3116 return _gdal.MDArray_GetOffsetStorageType(self, *args)
3117 3118
3119 - def GetScale(self, *args):
3120 """GetScale(MDArray self)""" 3121 return _gdal.MDArray_GetScale(self, *args)
3122 3123
3124 - def GetScaleStorageType(self, *args):
3125 """GetScaleStorageType(MDArray self) -> GDALDataType""" 3126 return _gdal.MDArray_GetScaleStorageType(self, *args)
3127 3128
3129 - def SetOffset(self, *args, **kwargs):
3130 """SetOffset(MDArray self, double val, GDALDataType storageType) -> CPLErr""" 3131 return _gdal.MDArray_SetOffset(self, *args, **kwargs)
3132 3133
3134 - def SetScale(self, *args, **kwargs):
3135 """SetScale(MDArray self, double val, GDALDataType storageType) -> CPLErr""" 3136 return _gdal.MDArray_SetScale(self, *args, **kwargs)
3137 3138
3139 - def SetUnit(self, *args):
3140 """SetUnit(MDArray self, char const * unit) -> CPLErr""" 3141 return _gdal.MDArray_SetUnit(self, *args)
3142 3143
3144 - def GetUnit(self, *args):
3145 """GetUnit(MDArray self) -> char const *""" 3146 return _gdal.MDArray_GetUnit(self, *args)
3147 3148
3149 - def SetSpatialRef(self, *args):
3150 """SetSpatialRef(MDArray self, SpatialReference srs) -> OGRErr""" 3151 return _gdal.MDArray_SetSpatialRef(self, *args)
3152 3153
3154 - def GetSpatialRef(self, *args):
3155 """GetSpatialRef(MDArray self) -> SpatialReference""" 3156 return _gdal.MDArray_GetSpatialRef(self, *args)
3157 3158
3159 - def GetView(self, *args):
3160 """GetView(MDArray self, char const * viewExpr) -> MDArray""" 3161 return _gdal.MDArray_GetView(self, *args)
3162 3163
3164 - def Transpose(self, *args):
3165 """Transpose(MDArray self, int nList) -> MDArray""" 3166 return _gdal.MDArray_Transpose(self, *args)
3167 3168
3169 - def GetUnscaled(self, *args):
3170 """GetUnscaled(MDArray self) -> MDArray""" 3171 return _gdal.MDArray_GetUnscaled(self, *args)
3172 3173
3174 - def GetMask(self, *args):
3175 """GetMask(MDArray self, char ** options=None) -> MDArray""" 3176 return _gdal.MDArray_GetMask(self, *args)
3177 3178
3179 - def AsClassicDataset(self, *args):
3180 """AsClassicDataset(MDArray self, size_t iXDim, size_t iYDim) -> Dataset""" 3181 return _gdal.MDArray_AsClassicDataset(self, *args)
3182 3183
3184 - def GetStatistics(self, *args, **kwargs):
3185 """GetStatistics(MDArray self, bool approx_ok=False, bool force=True, GDALProgressFunc callback=0, void * callback_data=None) -> Statistics""" 3186 return _gdal.MDArray_GetStatistics(self, *args, **kwargs)
3187 3188
3189 - def ComputeStatistics(self, *args, **kwargs):
3190 """ComputeStatistics(MDArray self, bool approx_ok=False, GDALProgressFunc callback=0, void * callback_data=None) -> Statistics""" 3191 return _gdal.MDArray_ComputeStatistics(self, *args, **kwargs)
3192 3193
3194 - def GetResampled(self, *args):
3195 """GetResampled(MDArray self, int nDimensions, GDALRIOResampleAlg resample_alg, OSRSpatialReferenceShadow ** srs, char ** options=None) -> MDArray""" 3196 return _gdal.MDArray_GetResampled(self, *args)
3197 3198
3199 - def Cache(self, *args):
3200 """Cache(MDArray self, char ** options=None) -> bool""" 3201 return _gdal.MDArray_Cache(self, *args)
3202 3203
3204 - def Read(self, 3205 array_start_idx = None, 3206 count = None, 3207 array_step = None, 3208 buffer_stride = None, 3209 buffer_datatype = None):
3210 if not array_start_idx: 3211 array_start_idx = [0] * self.GetDimensionCount() 3212 if not count: 3213 count = [ dim.GetSize() for dim in self.GetDimensions() ] 3214 if not array_step: 3215 array_step = [1] * self.GetDimensionCount() 3216 if not buffer_stride: 3217 stride = 1 3218 buffer_stride = [] 3219 # To compute strides we must proceed from the fastest varying dimension 3220 # (the last one), and then reverse the result 3221 for cnt in reversed(count): 3222 buffer_stride.append(stride) 3223 stride *= cnt 3224 buffer_stride.reverse() 3225 if not buffer_datatype: 3226 buffer_datatype = self.GetDataType() 3227 return _gdal.MDArray_Read(self, array_start_idx, count, array_step, buffer_stride, buffer_datatype)
3228
3229 - def ReadAsArray(self, 3230 array_start_idx = None, 3231 count = None, 3232 array_step = None, 3233 buffer_datatype = None, 3234 buf_obj = None):
3235 3236 from osgeo import gdal_array 3237 return gdal_array.MDArrayReadAsArray(self, array_start_idx, count, array_step, buffer_datatype, buf_obj)
3238
3239 - def AdviseRead(self, array_start_idx = None, count = None, options = []):
3240 if not array_start_idx: 3241 array_start_idx = [0] * self.GetDimensionCount() 3242 if not count: 3243 count = [ (self.GetDimensions()[i].GetSize() - array_start_idx[i]) for i in range (self.GetDimensionCount()) ] 3244 return _gdal.MDArray_AdviseRead(self, array_start_idx, count, options)
3245
3246 - def __getitem__(self, item):
3247 3248 def stringify(v): 3249 if v == Ellipsis: 3250 return '...' 3251 if isinstance(v, slice): 3252 return ':'.join([str(x) if x is not None else '' for x in (v.start, v.stop, v.step)]) 3253 if isinstance(v, str): 3254 return v 3255 if isinstance(v, (int, type(12345678901234))): 3256 return str(v) 3257 try: 3258 import numpy as np 3259 if v == np.newaxis: 3260 return 'newaxis' 3261 except: 3262 pass 3263 3264 return str(v)
3265 3266 if isinstance(item, str): 3267 return self.GetView('["' + item.replace('\\', '\\\\').replace('"', '\\"') + '"]') 3268 elif isinstance(item, slice): 3269 return self.GetView('[' + stringify(item) + ']') 3270 elif isinstance(item, tuple): 3271 return self.GetView('[' + ','.join([stringify(x) for x in item]) + ']') 3272 else: 3273 return self.GetView('[' + stringify(item) + ']')
3274
3275 - def Write(self, 3276 buffer, 3277 array_start_idx = None, 3278 count = None, 3279 array_step = None, 3280 buffer_stride = None, 3281 buffer_datatype = None):
3282 3283 dimCount = self.GetDimensionCount() 3284 3285 # Redirect to numpy-friendly WriteArray() if buffer is a numpy array 3286 # and other arguments are compatible 3287 if type(buffer).__name__ == 'ndarray' and \ 3288 count is None and buffer_stride is None and buffer_datatype is None: 3289 return self.WriteArray(buffer, array_start_idx=array_start_idx, array_step=array_step) 3290 3291 # Special case for buffer of type array and 1D arrays 3292 if dimCount == 1 and type(buffer).__name__ == 'array' and \ 3293 count is None and buffer_stride is None and buffer_datatype is None: 3294 map_typecode_itemsize_to_gdal = { 3295 ('B',1): GDT_Byte, 3296 ('h',2): GDT_Int16, 3297 ('H',2): GDT_UInt16, 3298 ('i',4): GDT_Int32, 3299 ('I',4): GDT_UInt32, 3300 ('l',4): GDT_Int32, 3301 # ('l',8): GDT_Int64, 3302 # ('q',8): GDT_Int64, 3303 # ('Q',8): GDT_UInt64, 3304 ('f', 4): GDT_Float32, 3305 ('d', 8): GDT_Float64 3306 } 3307 key = (buffer.typecode, buffer.itemsize) 3308 if key not in map_typecode_itemsize_to_gdal: 3309 raise Exception("unhandled type for buffer of type array") 3310 buffer_datatype = ExtendedDataType.Create(map_typecode_itemsize_to_gdal[key]) 3311 3312 # Special case for a list of numeric values and 1D arrays 3313 elif dimCount == 1 and type(buffer) == type([]) and len(buffer) != 0 \ 3314 and self.GetDataType().GetClass() != GEDTC_STRING: 3315 buffer_datatype = GDT_Int32 3316 for v in buffer: 3317 if isinstance(v, int): 3318 if v >= (1 << 31) or v < -(1 << 31): 3319 buffer_datatype = GDT_Float64 3320 elif isinstance(v, float): 3321 buffer_datatype = GDT_Float64 3322 else: 3323 raise ValueError('Only lists with integer or float elements are supported') 3324 import array 3325 buffer = array.array('d' if buffer_datatype == GDT_Float64 else 'i', buffer) 3326 buffer_datatype = ExtendedDataType.Create(buffer_datatype) 3327 3328 if not buffer_datatype: 3329 buffer_datatype = self.GetDataType() 3330 3331 is_1d_string = self.GetDataType().GetClass() == GEDTC_STRING and buffer_datatype.GetClass() == GEDTC_STRING and dimCount == 1 3332 3333 if not array_start_idx: 3334 array_start_idx = [0] * dimCount 3335 3336 if not count: 3337 if is_1d_string: 3338 assert type(buffer) == type([]) 3339 count = [ len(buffer) ] 3340 else: 3341 count = [ dim.GetSize() for dim in self.GetDimensions() ] 3342 3343 if not array_step: 3344 array_step = [1] * dimCount 3345 3346 if not buffer_stride: 3347 stride = 1 3348 buffer_stride = [] 3349 # To compute strides we must proceed from the fastest varying dimension 3350 # (the last one), and then reverse the result 3351 for cnt in reversed(count): 3352 buffer_stride.append(stride) 3353 stride *= cnt 3354 buffer_stride.reverse() 3355 3356 if is_1d_string: 3357 return _gdal.MDArray_WriteStringArray(self, array_start_idx, count, array_step, buffer_datatype, buffer) 3358 3359 return _gdal.MDArray_Write(self, array_start_idx, count, array_step, buffer_stride, buffer_datatype, buffer)
3360
3361 - def WriteArray(self, array, 3362 array_start_idx = None, 3363 array_step = None):
3364 3365 from osgeo import gdal_array 3366 return gdal_array.MDArrayWriteArray(self, array, array_start_idx, array_step)
3367
3368 - def ReadAsMaskedArray(self, 3369 array_start_idx = None, 3370 count = None, 3371 array_step = None):
3372 """ Return a numpy masked array of ReadAsArray() with GetMask() """ 3373 import numpy 3374 mask = self.GetMask() 3375 if mask is not None: 3376 array = self.ReadAsArray(array_start_idx, count, array_step) 3377 mask_array = mask.ReadAsArray(array_start_idx, count, array_step) 3378 bool_array = ~mask_array.astype(bool) 3379 return numpy.ma.array(array, mask=bool_array) 3380 else: 3381 return numpy.ma.array(self.ReadAsArray(array_start_idx, count, array_step), mask=None)
3382
3383 - def GetShape(self):
3384 """ Return the shape of the array """ 3385 if not self.GetDimensionCount(): 3386 return None 3387 shp = () 3388 for dim in self.GetDimensions(): 3389 shp += (dim.GetSize(),) 3390 return shp
3391 3392 shape = property(fget=GetShape, doc='Returns the shape of the array.') 3393
3394 - def GetNoDataValue(self):
3395 """GetNoDataValue(MDArray self) -> value """ 3396 3397 dt = self.GetDataType() 3398 if dt.GetClass() == GEDTC_NUMERIC and dt.GetNumericDataType() == gdalconst.GDT_Int64: 3399 return _gdal.MDArray_GetNoDataValueAsInt64(self) 3400 3401 if dt.GetClass() == GEDTC_NUMERIC and dt.GetNumericDataType() == gdalconst.GDT_UInt64: 3402 return _gdal.MDArray_GetNoDataValueAsUInt64(self) 3403 3404 return _gdal.MDArray_GetNoDataValueAsDouble(self)
3405 3406
3407 - def SetNoDataValue(self, value):
3408 """SetNoDataValue(MDArray self, value) -> CPLErr""" 3409 3410 dt = self.GetDataType() 3411 if dt.GetClass() == GEDTC_NUMERIC and dt.GetNumericDataType() == gdalconst.GDT_Int64: 3412 return _gdal.MDArray_SetNoDataValueInt64(self, value) 3413 3414 if dt.GetClass() == GEDTC_NUMERIC and dt.GetNumericDataType() == gdalconst.GDT_UInt64: 3415 return _gdal.MDArray_SetNoDataValueUInt64(self, value) 3416 3417 return _gdal.MDArray_SetNoDataValueDouble(self, value)
3418 3419 3420 MDArray_swigregister = _gdal.MDArray_swigregister 3421 MDArray_swigregister(MDArray) 3422
3423 -class Attribute(_object):
3424 """Proxy of C++ GDALAttributeHS class.""" 3425 3426 __swig_setmethods__ = {} 3427 __setattr__ = lambda self, name, value: _swig_setattr(self, Attribute, name, value) 3428 __swig_getmethods__ = {} 3429 __getattr__ = lambda self, name: _swig_getattr(self, Attribute, name) 3430
3431 - def __init__(self, *args, **kwargs):
3432 raise AttributeError("No constructor defined")
3433 __repr__ = _swig_repr 3434 __swig_destroy__ = _gdal.delete_Attribute 3435 __del__ = lambda self: None 3436
3437 - def GetName(self, *args):
3438 """GetName(Attribute self) -> char const *""" 3439 return _gdal.Attribute_GetName(self, *args)
3440 3441
3442 - def GetFullName(self, *args):
3443 """GetFullName(Attribute self) -> char const *""" 3444 return _gdal.Attribute_GetFullName(self, *args)
3445 3446
3447 - def GetTotalElementsCount(self, *args):
3448 """GetTotalElementsCount(Attribute self) -> unsigned long long""" 3449 return _gdal.Attribute_GetTotalElementsCount(self, *args)
3450 3451
3452 - def GetDimensionCount(self, *args):
3453 """GetDimensionCount(Attribute self) -> size_t""" 3454 return _gdal.Attribute_GetDimensionCount(self, *args)
3455 3456
3457 - def GetDimensionsSize(self, *args):
3458 """GetDimensionsSize(Attribute self)""" 3459 return _gdal.Attribute_GetDimensionsSize(self, *args)
3460 3461
3462 - def GetDataType(self, *args):
3463 """GetDataType(Attribute self) -> ExtendedDataType""" 3464 return _gdal.Attribute_GetDataType(self, *args)
3465 3466
3467 - def ReadAsRaw(self, *args):
3468 """ReadAsRaw(Attribute self) -> CPLErr""" 3469 return _gdal.Attribute_ReadAsRaw(self, *args)
3470 3471
3472 - def ReadAsString(self, *args):
3473 """ReadAsString(Attribute self) -> char const *""" 3474 return _gdal.Attribute_ReadAsString(self, *args)
3475 3476
3477 - def ReadAsInt(self, *args):
3478 """ReadAsInt(Attribute self) -> int""" 3479 return _gdal.Attribute_ReadAsInt(self, *args)
3480 3481
3482 - def ReadAsDouble(self, *args):
3483 """ReadAsDouble(Attribute self) -> double""" 3484 return _gdal.Attribute_ReadAsDouble(self, *args)
3485 3486
3487 - def ReadAsStringArray(self, *args):
3488 """ReadAsStringArray(Attribute self) -> char **""" 3489 return _gdal.Attribute_ReadAsStringArray(self, *args)
3490 3491
3492 - def ReadAsIntArray(self, *args):
3493 """ReadAsIntArray(Attribute self)""" 3494 return _gdal.Attribute_ReadAsIntArray(self, *args)
3495 3496
3497 - def ReadAsDoubleArray(self, *args):
3498 """ReadAsDoubleArray(Attribute self)""" 3499 return _gdal.Attribute_ReadAsDoubleArray(self, *args)
3500 3501
3502 - def WriteRaw(self, *args):
3503 """WriteRaw(Attribute self, GIntBig nLen) -> CPLErr""" 3504 return _gdal.Attribute_WriteRaw(self, *args)
3505 3506
3507 - def WriteString(self, *args):
3508 """WriteString(Attribute self, char const * val) -> CPLErr""" 3509 return _gdal.Attribute_WriteString(self, *args)
3510 3511
3512 - def WriteStringArray(self, *args):
3513 """WriteStringArray(Attribute self, char ** vals) -> CPLErr""" 3514 return _gdal.Attribute_WriteStringArray(self, *args)
3515 3516
3517 - def WriteInt(self, *args):
3518 """WriteInt(Attribute self, int val) -> CPLErr""" 3519 return _gdal.Attribute_WriteInt(self, *args)
3520 3521
3522 - def WriteDouble(self, *args):
3523 """WriteDouble(Attribute self, double val) -> CPLErr""" 3524 return _gdal.Attribute_WriteDouble(self, *args)
3525 3526
3527 - def WriteDoubleArray(self, *args):
3528 """WriteDoubleArray(Attribute self, int nList) -> CPLErr""" 3529 return _gdal.Attribute_WriteDoubleArray(self, *args)
3530 3531 3532
3533 - def Read(self):
3534 """ Read an attribute and return it with the most appropriate type """ 3535 dt = self.GetDataType() 3536 dt_class = dt.GetClass() 3537 if dt_class == GEDTC_STRING: 3538 if self.GetTotalElementsCount() == 1: 3539 s = self.ReadAsString() 3540 if dt.GetSubType() == GEDTST_JSON: 3541 try: 3542 import json 3543 return json.loads(s) 3544 except: 3545 pass 3546 return s 3547 return self.ReadAsStringArray() 3548 if dt_class == GEDTC_NUMERIC: 3549 if dt.GetNumericDataType() in (GDT_Byte, GDT_Int16, GDT_UInt16, GDT_Int32): 3550 if self.GetTotalElementsCount() == 1: 3551 return self.ReadAsInt() 3552 else: 3553 return self.ReadAsIntArray() 3554 else: 3555 if self.GetTotalElementsCount() == 1: 3556 return self.ReadAsDouble() 3557 else: 3558 return self.ReadAsDoubleArray() 3559 return self.ReadAsRaw()
3560
3561 - def Write(self, val):
3562 if isinstance(val, (int, type(12345678901234))): 3563 if val >= -0x80000000 and val <= 0x7FFFFFFF: 3564 return self.WriteInt(val) 3565 else: 3566 return self.WriteDouble(val) 3567 if isinstance(val, float): 3568 return self.WriteDouble(val) 3569 if isinstance(val, str) and self.GetDataType().GetClass() != GEDTC_COMPOUND: 3570 return self.WriteString(val) 3571 if isinstance(val, list): 3572 if len(val) == 0: 3573 if self.GetDataType().GetClass() == GEDTC_STRING: 3574 return self.WriteStringArray(val) 3575 else: 3576 return self.WriteDoubleArray(val) 3577 if isinstance(val[0], (int, type(12345678901234), float)): 3578 return self.WriteDoubleArray(val) 3579 if isinstance(val[0], str): 3580 return self.WriteStringArray(val) 3581 if isinstance(val, dict) and self.GetDataType().GetSubType() == GEDTST_JSON: 3582 import json 3583 return self.WriteString(json.dumps(val)) 3584 return self.WriteRaw(val)
3585 3586 3587 Attribute_swigregister = _gdal.Attribute_swigregister 3588 Attribute_swigregister(Attribute) 3589
3590 -class Dimension(_object):
3591 """Proxy of C++ GDALDimensionHS class.""" 3592 3593 __swig_setmethods__ = {} 3594 __setattr__ = lambda self, name, value: _swig_setattr(self, Dimension, name, value) 3595 __swig_getmethods__ = {} 3596 __getattr__ = lambda self, name: _swig_getattr(self, Dimension, name) 3597
3598 - def __init__(self, *args, **kwargs):
3599 raise AttributeError("No constructor defined")
3600 __repr__ = _swig_repr 3601 __swig_destroy__ = _gdal.delete_Dimension 3602 __del__ = lambda self: None 3603
3604 - def GetName(self, *args):
3605 """GetName(Dimension self) -> char const *""" 3606 return _gdal.Dimension_GetName(self, *args)
3607 3608
3609 - def GetFullName(self, *args):
3610 """GetFullName(Dimension self) -> char const *""" 3611 return _gdal.Dimension_GetFullName(self, *args)
3612 3613
3614 - def GetType(self, *args):
3615 """GetType(Dimension self) -> char const *""" 3616 return _gdal.Dimension_GetType(self, *args)
3617 3618
3619 - def GetDirection(self, *args):
3620 """GetDirection(Dimension self) -> char const *""" 3621 return _gdal.Dimension_GetDirection(self, *args)
3622 3623
3624 - def GetSize(self, *args):
3625 """GetSize(Dimension self) -> unsigned long long""" 3626 return _gdal.Dimension_GetSize(self, *args)
3627 3628
3629 - def GetIndexingVariable(self, *args):
3630 """GetIndexingVariable(Dimension self) -> MDArray""" 3631 return _gdal.Dimension_GetIndexingVariable(self, *args)
3632 3633
3634 - def SetIndexingVariable(self, *args):
3635 """SetIndexingVariable(Dimension self, MDArray array) -> bool""" 3636 return _gdal.Dimension_SetIndexingVariable(self, *args)
3637 3638 Dimension_swigregister = _gdal.Dimension_swigregister 3639 Dimension_swigregister(Dimension) 3640 3641 GEDTC_NUMERIC = _gdal.GEDTC_NUMERIC 3642 GEDTC_STRING = _gdal.GEDTC_STRING 3643 GEDTC_COMPOUND = _gdal.GEDTC_COMPOUND
3644 -class ExtendedDataType(_object):
3645 """Proxy of C++ GDALExtendedDataTypeHS class.""" 3646 3647 __swig_setmethods__ = {} 3648 __setattr__ = lambda self, name, value: _swig_setattr(self, ExtendedDataType, name, value) 3649 __swig_getmethods__ = {} 3650 __getattr__ = lambda self, name: _swig_getattr(self, ExtendedDataType, name) 3651
3652 - def __init__(self, *args, **kwargs):
3653 raise AttributeError("No constructor defined")
3654 __repr__ = _swig_repr 3655 __swig_destroy__ = _gdal.delete_ExtendedDataType 3656 __del__ = lambda self: None 3657
3658 - def Create(*args):
3659 """Create(GDALDataType dt) -> ExtendedDataType""" 3660 return _gdal.ExtendedDataType_Create(*args)
3661 3662 Create = staticmethod(Create) 3663
3664 - def CreateString(*args):
3665 """CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE) -> ExtendedDataType""" 3666 return _gdal.ExtendedDataType_CreateString(*args)
3667 3668 CreateString = staticmethod(CreateString) 3669
3670 - def CreateCompound(*args):
3671 """CreateCompound(char const * name, size_t nTotalSize, int nComps) -> ExtendedDataType""" 3672 return _gdal.ExtendedDataType_CreateCompound(*args)
3673 3674 CreateCompound = staticmethod(CreateCompound) 3675
3676 - def GetName(self, *args):
3677 """GetName(ExtendedDataType self) -> char const *""" 3678 return _gdal.ExtendedDataType_GetName(self, *args)
3679 3680
3681 - def GetClass(self, *args):
3682 """GetClass(ExtendedDataType self) -> GDALExtendedDataTypeClass""" 3683 return _gdal.ExtendedDataType_GetClass(self, *args)
3684 3685
3686 - def GetNumericDataType(self, *args):
3687 """GetNumericDataType(ExtendedDataType self) -> GDALDataType""" 3688 return _gdal.ExtendedDataType_GetNumericDataType(self, *args)
3689 3690
3691 - def GetSize(self, *args):
3692 """GetSize(ExtendedDataType self) -> size_t""" 3693 return _gdal.ExtendedDataType_GetSize(self, *args)
3694 3695
3696 - def GetMaxStringLength(self, *args):
3697 """GetMaxStringLength(ExtendedDataType self) -> size_t""" 3698 return _gdal.ExtendedDataType_GetMaxStringLength(self, *args)
3699 3700
3701 - def GetSubType(self, *args):
3702 """GetSubType(ExtendedDataType self) -> GDALExtendedDataTypeSubType""" 3703 return _gdal.ExtendedDataType_GetSubType(self, *args)
3704 3705
3706 - def GetComponents(self, *args):
3707 """GetComponents(ExtendedDataType self)""" 3708 return _gdal.ExtendedDataType_GetComponents(self, *args)
3709 3710
3711 - def CanConvertTo(self, *args):
3712 """CanConvertTo(ExtendedDataType self, ExtendedDataType other) -> bool""" 3713 return _gdal.ExtendedDataType_CanConvertTo(self, *args)
3714 3715
3716 - def Equals(self, *args):
3717 """Equals(ExtendedDataType self, ExtendedDataType other) -> bool""" 3718 return _gdal.ExtendedDataType_Equals(self, *args)
3719 3720 3721
3722 - def __eq__(self, other):
3723 return self.Equals(other)
3724
3725 - def __ne__(self, other):
3726 return not self.__eq__(other)
3727 3728 ExtendedDataType_swigregister = _gdal.ExtendedDataType_swigregister 3729 ExtendedDataType_swigregister(ExtendedDataType) 3730
3731 -def ExtendedDataType_Create(*args):
3732 """ExtendedDataType_Create(GDALDataType dt) -> ExtendedDataType""" 3733 return _gdal.ExtendedDataType_Create(*args)
3734
3735 -def ExtendedDataType_CreateString(*args):
3736 """ExtendedDataType_CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE) -> ExtendedDataType""" 3737 return _gdal.ExtendedDataType_CreateString(*args)
3738
3739 -def ExtendedDataType_CreateCompound(*args):
3740 """ExtendedDataType_CreateCompound(char const * name, size_t nTotalSize, int nComps) -> ExtendedDataType""" 3741 return _gdal.ExtendedDataType_CreateCompound(*args)
3742
3743 -class EDTComponent(_object):
3744 """Proxy of C++ GDALEDTComponentHS class.""" 3745 3746 __swig_setmethods__ = {} 3747 __setattr__ = lambda self, name, value: _swig_setattr(self, EDTComponent, name, value) 3748 __swig_getmethods__ = {} 3749 __getattr__ = lambda self, name: _swig_getattr(self, EDTComponent, name) 3750
3751 - def __init__(self, *args, **kwargs):
3752 raise AttributeError("No constructor defined")
3753 __repr__ = _swig_repr 3754 __swig_destroy__ = _gdal.delete_EDTComponent 3755 __del__ = lambda self: None 3756
3757 - def Create(*args):
3758 """Create(char const * name, size_t offset, ExtendedDataType type) -> EDTComponent""" 3759 return _gdal.EDTComponent_Create(*args)
3760 3761 Create = staticmethod(Create) 3762
3763 - def GetName(self, *args):
3764 """GetName(EDTComponent self) -> char const *""" 3765 return _gdal.EDTComponent_GetName(self, *args)
3766 3767
3768 - def GetOffset(self, *args):
3769 """GetOffset(EDTComponent self) -> size_t""" 3770 return _gdal.EDTComponent_GetOffset(self, *args)
3771 3772
3773 - def GetType(self, *args):
3774 """GetType(EDTComponent self) -> ExtendedDataType""" 3775 return _gdal.EDTComponent_GetType(self, *args)
3776 3777 EDTComponent_swigregister = _gdal.EDTComponent_swigregister 3778 EDTComponent_swigregister(EDTComponent) 3779
3780 -def EDTComponent_Create(*args):
3781 """EDTComponent_Create(char const * name, size_t offset, ExtendedDataType type) -> EDTComponent""" 3782 return _gdal.EDTComponent_Create(*args)
3783
3784 -class Band(MajorObject):
3785 """Proxy of C++ GDALRasterBandShadow class.""" 3786 3787 __swig_setmethods__ = {} 3788 for _s in [MajorObject]: 3789 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) 3790 __setattr__ = lambda self, name, value: _swig_setattr(self, Band, name, value) 3791 __swig_getmethods__ = {} 3792 for _s in [MajorObject]: 3793 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) 3794 __getattr__ = lambda self, name: _swig_getattr(self, Band, name) 3795
3796 - def __init__(self, *args, **kwargs):
3797 raise AttributeError("No constructor defined")
3798 __repr__ = _swig_repr 3799 __swig_getmethods__["XSize"] = _gdal.Band_XSize_get 3800 if _newclass: 3801 XSize = _swig_property(_gdal.Band_XSize_get) 3802 __swig_getmethods__["YSize"] = _gdal.Band_YSize_get 3803 if _newclass: 3804 YSize = _swig_property(_gdal.Band_YSize_get) 3805 __swig_getmethods__["DataType"] = _gdal.Band_DataType_get 3806 if _newclass: 3807 DataType = _swig_property(_gdal.Band_DataType_get) 3808
3809 - def GetDataset(self, *args):
3810 """GetDataset(Band self) -> Dataset""" 3811 return _gdal.Band_GetDataset(self, *args)
3812 3813
3814 - def GetBand(self, *args):
3815 """GetBand(Band self) -> int""" 3816 return _gdal.Band_GetBand(self, *args)
3817 3818
3819 - def GetBlockSize(self, *args):
3820 """GetBlockSize(Band self)""" 3821 return _gdal.Band_GetBlockSize(self, *args)
3822 3823
3824 - def GetActualBlockSize(self, *args):
3825 """GetActualBlockSize(Band self, int nXBlockOff, int nYBlockOff)""" 3826 return _gdal.Band_GetActualBlockSize(self, *args)
3827 3828
3829 - def GetColorInterpretation(self, *args):
3830 """GetColorInterpretation(Band self) -> GDALColorInterp""" 3831 return _gdal.Band_GetColorInterpretation(self, *args)
3832 3833
3834 - def GetRasterColorInterpretation(self, *args):
3835 """GetRasterColorInterpretation(Band self) -> GDALColorInterp""" 3836 return _gdal.Band_GetRasterColorInterpretation(self, *args)
3837 3838
3839 - def SetColorInterpretation(self, *args):
3840 """SetColorInterpretation(Band self, GDALColorInterp val) -> CPLErr""" 3841 return _gdal.Band_SetColorInterpretation(self, *args)
3842 3843
3844 - def SetRasterColorInterpretation(self, *args):
3845 """SetRasterColorInterpretation(Band self, GDALColorInterp val) -> CPLErr""" 3846 return _gdal.Band_SetRasterColorInterpretation(self, *args)
3847 3848
3849 - def GetNoDataValue(self, *args):
3850 """GetNoDataValue(Band self)""" 3851 return _gdal.Band_GetNoDataValue(self, *args)
3852 3853
3854 - def GetNoDataValueAsInt64(self, *args):
3855 """GetNoDataValueAsInt64(Band self)""" 3856 return _gdal.Band_GetNoDataValueAsInt64(self, *args)
3857 3858
3859 - def GetNoDataValueAsUInt64(self, *args):
3860 """GetNoDataValueAsUInt64(Band self)""" 3861 return _gdal.Band_GetNoDataValueAsUInt64(self, *args)
3862 3863
3864 - def SetNoDataValue(self, *args):
3865 """SetNoDataValue(Band self, double d) -> CPLErr""" 3866 return _gdal.Band_SetNoDataValue(self, *args)
3867 3868
3869 - def SetNoDataValueAsInt64(self, *args):
3870 """SetNoDataValueAsInt64(Band self, GIntBig v) -> CPLErr""" 3871 return _gdal.Band_SetNoDataValueAsInt64(self, *args)
3872 3873
3874 - def SetNoDataValueAsUInt64(self, *args):
3875 """SetNoDataValueAsUInt64(Band self, GUIntBig v) -> CPLErr""" 3876 return _gdal.Band_SetNoDataValueAsUInt64(self, *args)
3877 3878
3879 - def DeleteNoDataValue(self, *args):
3880 """DeleteNoDataValue(Band self) -> CPLErr""" 3881 return _gdal.Band_DeleteNoDataValue(self, *args)
3882 3883
3884 - def GetUnitType(self, *args):
3885 """GetUnitType(Band self) -> char const *""" 3886 return _gdal.Band_GetUnitType(self, *args)
3887 3888
3889 - def SetUnitType(self, *args):
3890 """SetUnitType(Band self, char const * val) -> CPLErr""" 3891 return _gdal.Band_SetUnitType(self, *args)
3892 3893
3894 - def GetRasterCategoryNames(self, *args):
3895 """GetRasterCategoryNames(Band self) -> char **""" 3896 return _gdal.Band_GetRasterCategoryNames(self, *args)
3897 3898
3899 - def SetRasterCategoryNames(self, *args):
3900 """SetRasterCategoryNames(Band self, char ** names) -> CPLErr""" 3901 return _gdal.Band_SetRasterCategoryNames(self, *args)
3902 3903
3904 - def GetMinimum(self, *args):
3905 """GetMinimum(Band self)""" 3906 return _gdal.Band_GetMinimum(self, *args)
3907 3908
3909 - def GetMaximum(self, *args):
3910 """GetMaximum(Band self)""" 3911 return _gdal.Band_GetMaximum(self, *args)
3912 3913
3914 - def GetOffset(self, *args):
3915 """GetOffset(Band self)""" 3916 return _gdal.Band_GetOffset(self, *args)
3917 3918
3919 - def GetScale(self, *args):
3920 """GetScale(Band self)""" 3921 return _gdal.Band_GetScale(self, *args)
3922 3923
3924 - def SetOffset(self, *args):
3925 """SetOffset(Band self, double val) -> CPLErr""" 3926 return _gdal.Band_SetOffset(self, *args)
3927 3928
3929 - def SetScale(self, *args):
3930 """SetScale(Band self, double val) -> CPLErr""" 3931 return _gdal.Band_SetScale(self, *args)
3932 3933
3934 - def GetStatistics(self, *args):
3935 """GetStatistics(Band self, int approx_ok, int force) -> CPLErr""" 3936 return _gdal.Band_GetStatistics(self, *args)
3937 3938
3939 - def ComputeStatistics(self, *args):
3940 """ComputeStatistics(Band self, bool approx_ok, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr""" 3941 return _gdal.Band_ComputeStatistics(self, *args)
3942 3943
3944 - def SetStatistics(self, *args):
3945 """SetStatistics(Band self, double min, double max, double mean, double stddev) -> CPLErr""" 3946 return _gdal.Band_SetStatistics(self, *args)
3947 3948
3949 - def GetOverviewCount(self, *args):
3950 """GetOverviewCount(Band self) -> int""" 3951 return _gdal.Band_GetOverviewCount(self, *args)
3952 3953
3954 - def GetOverview(self, *args):
3955 """GetOverview(Band self, int i) -> Band""" 3956 return _gdal.Band_GetOverview(self, *args)
3957 3958
3959 - def Checksum(self, *args, **kwargs):
3960 """Checksum(Band self, int xoff=0, int yoff=0, int * xsize=None, int * ysize=None) -> int""" 3961 return _gdal.Band_Checksum(self, *args, **kwargs)
3962 3963
3964 - def ComputeRasterMinMax(self, *args):
3965 """ComputeRasterMinMax(Band self, int approx_ok=0)""" 3966 return _gdal.Band_ComputeRasterMinMax(self, *args)
3967 3968
3969 - def ComputeBandStats(self, *args):
3970 """ComputeBandStats(Band self, int samplestep=1)""" 3971 return _gdal.Band_ComputeBandStats(self, *args)
3972 3973
3974 - def Fill(self, *args):
3975 """Fill(Band self, double real_fill, double imag_fill=0.0) -> CPLErr""" 3976 return _gdal.Band_Fill(self, *args)
3977 3978
3979 - def WriteRaster(self, *args, **kwargs):
3980 """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""" 3981 return _gdal.Band_WriteRaster(self, *args, **kwargs)
3982 3983
3984 - def FlushCache(self, *args):
3985 """FlushCache(Band self)""" 3986 return _gdal.Band_FlushCache(self, *args)
3987 3988
3989 - def GetRasterColorTable(self, *args):
3990 """GetRasterColorTable(Band self) -> ColorTable""" 3991 return _gdal.Band_GetRasterColorTable(self, *args)
3992 3993
3994 - def GetColorTable(self, *args):
3995 """GetColorTable(Band self) -> ColorTable""" 3996 return _gdal.Band_GetColorTable(self, *args)
3997 3998
3999 - def SetRasterColorTable(self, *args):
4000 """SetRasterColorTable(Band self, ColorTable arg) -> int""" 4001 return _gdal.Band_SetRasterColorTable(self, *args)
4002 4003
4004 - def SetColorTable(self, *args):
4005 """SetColorTable(Band self, ColorTable arg) -> int""" 4006 return _gdal.Band_SetColorTable(self, *args)
4007 4008
4009 - def GetDefaultRAT(self, *args):
4010 """GetDefaultRAT(Band self) -> RasterAttributeTable""" 4011 return _gdal.Band_GetDefaultRAT(self, *args)
4012 4013
4014 - def SetDefaultRAT(self, *args):
4015 """SetDefaultRAT(Band self, RasterAttributeTable table) -> int""" 4016 return _gdal.Band_SetDefaultRAT(self, *args)
4017 4018
4019 - def GetMaskBand(self, *args):
4020 """GetMaskBand(Band self) -> Band""" 4021 return _gdal.Band_GetMaskBand(self, *args)
4022 4023
4024 - def GetMaskFlags(self, *args):
4025 """GetMaskFlags(Band self) -> int""" 4026 return _gdal.Band_GetMaskFlags(self, *args)
4027 4028
4029 - def CreateMaskBand(self, *args):
4030 """CreateMaskBand(Band self, int nFlags) -> CPLErr""" 4031 return _gdal.Band_CreateMaskBand(self, *args)
4032 4033
4034 - def IsMaskBand(self, *args):
4035 """IsMaskBand(Band self) -> bool""" 4036 return _gdal.Band_IsMaskBand(self, *args)
4037 4038
4039 - def GetHistogram(self, *args, **kwargs):
4040 """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""" 4041 return _gdal.Band_GetHistogram(self, *args, **kwargs)
4042 4043
4044 - def GetDefaultHistogram(self, *args, **kwargs):
4045 """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""" 4046 return _gdal.Band_GetDefaultHistogram(self, *args, **kwargs)
4047 4048
4049 - def SetDefaultHistogram(self, *args):
4050 """SetDefaultHistogram(Band self, double min, double max, int buckets_in) -> CPLErr""" 4051 return _gdal.Band_SetDefaultHistogram(self, *args)
4052 4053
4054 - def HasArbitraryOverviews(self, *args):
4055 """HasArbitraryOverviews(Band self) -> bool""" 4056 return _gdal.Band_HasArbitraryOverviews(self, *args)
4057 4058
4059 - def GetCategoryNames(self, *args):
4060 """GetCategoryNames(Band self) -> char **""" 4061 return _gdal.Band_GetCategoryNames(self, *args)
4062 4063
4064 - def SetCategoryNames(self, *args):
4065 """SetCategoryNames(Band self, char ** papszCategoryNames) -> CPLErr""" 4066 return _gdal.Band_SetCategoryNames(self, *args)
4067 4068
4069 - def GetVirtualMem(self, *args, **kwargs):
4070 """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""" 4071 return _gdal.Band_GetVirtualMem(self, *args, **kwargs)
4072 4073
4074 - def GetVirtualMemAuto(self, *args, **kwargs):
4075 """GetVirtualMemAuto(Band self, GDALRWFlag eRWFlag, char ** options=None) -> VirtualMem""" 4076 return _gdal.Band_GetVirtualMemAuto(self, *args, **kwargs)
4077 4078
4079 - def GetTiledVirtualMem(self, *args, **kwargs):
4080 """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""" 4081 return _gdal.Band_GetTiledVirtualMem(self, *args, **kwargs)
4082 4083
4084 - def GetDataCoverageStatus(self, *args):
4085 """GetDataCoverageStatus(Band self, int nXOff, int nYOff, int nXSize, int nYSize, int nMaskFlagStop=0) -> int""" 4086 return _gdal.Band_GetDataCoverageStatus(self, *args)
4087 4088
4089 - def AdviseRead(self, *args):
4090 """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""" 4091 return _gdal.Band_AdviseRead(self, *args)
4092 4093
4094 - def AsMDArray(self, *args):
4095 """AsMDArray(Band self) -> MDArray""" 4096 return _gdal.Band_AsMDArray(self, *args)
4097 4098
4099 - def ReadRaster1(self, *args, **kwargs):
4100 """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""" 4101 return _gdal.Band_ReadRaster1(self, *args, **kwargs)
4102 4103
4104 - def ReadBlock(self, *args, **kwargs):
4105 """ReadBlock(Band self, int xoff, int yoff, void * buf_obj=None) -> CPLErr""" 4106 return _gdal.Band_ReadBlock(self, *args, **kwargs)
4107 4108 4109
4110 - def ComputeStatistics(self, *args):
4111 """ComputeStatistics(Band self, bool approx_ok, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr""" 4112 4113 # For backward compatibility. New SWIG has stricter typing and really 4114 # enforces bool 4115 approx_ok = args[0] 4116 if approx_ok == 0: 4117 approx_ok = False 4118 elif approx_ok == 1: 4119 approx_ok = True 4120 new_args = [approx_ok] 4121 for arg in args[1:]: 4122 new_args.append( arg ) 4123 4124 return _gdal.Band_ComputeStatistics(self, *new_args)
4125 4126
4127 - def ReadRaster(self, xoff=0, yoff=0, xsize=None, ysize=None, 4128 buf_xsize=None, buf_ysize=None, buf_type=None, 4129 buf_pixel_space=None, buf_line_space=None, 4130 resample_alg=gdalconst.GRIORA_NearestNeighbour, 4131 callback=None, 4132 callback_data=None, 4133 buf_obj=None):
4134 4135 if xsize is None: 4136 xsize = self.XSize 4137 if ysize is None: 4138 ysize = self.YSize 4139 4140 return _gdal.Band_ReadRaster1(self, xoff, yoff, xsize, ysize, 4141 buf_xsize, buf_ysize, buf_type, 4142 buf_pixel_space, buf_line_space, 4143 resample_alg, callback, callback_data, 4144 buf_obj)
4145
4146 - def WriteRaster(self, xoff, yoff, xsize, ysize, 4147 buf_string, 4148 buf_xsize=None, buf_ysize=None, buf_type=None, 4149 buf_pixel_space=None, buf_line_space=None ):
4150 4151 if buf_xsize is None: 4152 buf_xsize = xsize 4153 if buf_ysize is None: 4154 buf_ysize = ysize 4155 4156 # Redirect to numpy-friendly WriteArray() if buf_string is a numpy array 4157 # and other arguments are compatible 4158 if type(buf_string).__name__ == 'ndarray' and \ 4159 buf_xsize == xsize and buf_ysize == ysize and buf_type is None and \ 4160 buf_pixel_space is None and buf_line_space is None: 4161 return self.WriteArray(buf_string, xoff=xoff, yoff=yoff) 4162 4163 if buf_type is None: 4164 buf_type = self.DataType 4165 4166 return _gdal.Band_WriteRaster(self, 4167 xoff, yoff, xsize, ysize, 4168 buf_string, buf_xsize, buf_ysize, buf_type, 4169 buf_pixel_space, buf_line_space )
4170
4171 - def ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None, 4172 buf_xsize=None, buf_ysize=None, buf_type=None, buf_obj=None, 4173 resample_alg=gdalconst.GRIORA_NearestNeighbour, 4174 callback=None, 4175 callback_data=None):
4176 """ Reading a chunk of a GDAL band into a numpy array. The optional (buf_xsize,buf_ysize,buf_type) 4177 parameters should generally not be specified if buf_obj is specified. The array is returned""" 4178 4179 from osgeo import gdal_array 4180 4181 return gdal_array.BandReadAsArray(self, xoff, yoff, 4182 win_xsize, win_ysize, 4183 buf_xsize, buf_ysize, buf_type, buf_obj, 4184 resample_alg=resample_alg, 4185 callback=callback, 4186 callback_data=callback_data)
4187
4188 - def WriteArray(self, array, xoff=0, yoff=0, 4189 resample_alg=gdalconst.GRIORA_NearestNeighbour, 4190 callback=None, 4191 callback_data=None):
4192 from osgeo import gdal_array 4193 4194 return gdal_array.BandWriteArray(self, array, xoff, yoff, 4195 resample_alg=resample_alg, 4196 callback=callback, 4197 callback_data=callback_data)
4198
4199 - def GetVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0, 4200 xsize=None, ysize=None, bufxsize=None, bufysize=None, 4201 datatype=None, 4202 cache_size = 10 * 1024 * 1024, page_size_hint = 0, 4203 options=None):
4204 """Return a NumPy array for the band, seen as a virtual memory mapping. 4205 An element is accessed with array[y][x]. 4206 Any reference to the array must be dropped before the last reference to the 4207 related dataset is also dropped. 4208 """ 4209 from osgeo import gdal_array 4210 if xsize is None: 4211 xsize = self.XSize 4212 if ysize is None: 4213 ysize = self.YSize 4214 if bufxsize is None: 4215 bufxsize = self.XSize 4216 if bufysize is None: 4217 bufysize = self.YSize 4218 if datatype is None: 4219 datatype = self.DataType 4220 if options is None: 4221 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, cache_size, page_size_hint) 4222 else: 4223 virtualmem = self.GetVirtualMem(eAccess, xoff, yoff, xsize, ysize, bufxsize, bufysize, datatype, cache_size, page_size_hint, options) 4224 return gdal_array.VirtualMemGetArray(virtualmem)
4225
4226 - def GetVirtualMemAutoArray(self, eAccess=gdalconst.GF_Read, options=None):
4227 """Return a NumPy array for the band, seen as a virtual memory mapping. 4228 An element is accessed with array[y][x]. 4229 Any reference to the array must be dropped before the last reference to the 4230 related dataset is also dropped. 4231 """ 4232 from osgeo import gdal_array 4233 if options is None: 4234 virtualmem = self.GetVirtualMemAuto(eAccess) 4235 else: 4236 virtualmem = self.GetVirtualMemAuto(eAccess,options) 4237 return gdal_array.VirtualMemGetArray( virtualmem )
4238
4239 - def GetTiledVirtualMemArray(self, eAccess=gdalconst.GF_Read, xoff=0, yoff=0, 4240 xsize=None, ysize=None, tilexsize=256, tileysize=256, 4241 datatype=None, 4242 cache_size = 10 * 1024 * 1024, options=None):
4243 """Return a NumPy array for the band, seen as a virtual memory mapping with 4244 a tile organization. 4245 An element is accessed with array[tiley][tilex][y][x]. 4246 Any reference to the array must be dropped before the last reference to the 4247 related dataset is also dropped. 4248 """ 4249 from osgeo import gdal_array 4250 if xsize is None: 4251 xsize = self.XSize 4252 if ysize is None: 4253 ysize = self.YSize 4254 if datatype is None: 4255 datatype = self.DataType 4256 if options is None: 4257 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,cache_size) 4258 else: 4259 virtualmem = self.GetTiledVirtualMem(eAccess,xoff,yoff,xsize,ysize,tilexsize,tileysize,datatype,cache_size,options) 4260 return gdal_array.VirtualMemGetArray( virtualmem )
4261
4262 - def GetNoDataValue(self):
4263 """GetNoDataValue(Band self) -> value """ 4264 4265 if self.DataType == gdalconst.GDT_Int64: 4266 return _gdal.Band_GetNoDataValueAsInt64(self) 4267 4268 if self.DataType == gdalconst.GDT_UInt64: 4269 return _gdal.Band_GetNoDataValueAsUInt64(self) 4270 4271 return _gdal.Band_GetNoDataValue(self)
4272 4273
4274 - def SetNoDataValue(self, value):
4275 """SetNoDataValue(Band self, value) -> CPLErr""" 4276 4277 if self.DataType == gdalconst.GDT_Int64: 4278 return _gdal.Band_SetNoDataValueAsInt64(self, value) 4279 4280 if self.DataType == gdalconst.GDT_UInt64: 4281 return _gdal.Band_SetNoDataValueAsUInt64(self, value) 4282 4283 return _gdal.Band_SetNoDataValue(self, value)
4284 4285 4286 Band_swigregister = _gdal.Band_swigregister 4287 Band_swigregister(Band) 4288
4289 -class ColorTable(_object):
4290 """Proxy of C++ GDALColorTableShadow class.""" 4291 4292 __swig_setmethods__ = {} 4293 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorTable, name, value) 4294 __swig_getmethods__ = {} 4295 __getattr__ = lambda self, name: _swig_getattr(self, ColorTable, name) 4296 __repr__ = _swig_repr 4297
4298 - def __init__(self, *args, **kwargs):
4299 """__init__(GDALColorTableShadow self, GDALPaletteInterp palette) -> ColorTable""" 4300 this = _gdal.new_ColorTable(*args, **kwargs) 4301 try: 4302 self.this.append(this) 4303 except __builtin__.Exception: 4304 self.this = this
4305 __swig_destroy__ = _gdal.delete_ColorTable 4306 __del__ = lambda self: None 4307
4308 - def Clone(self, *args):
4309 """Clone(ColorTable self) -> ColorTable""" 4310 return _gdal.ColorTable_Clone(self, *args)
4311 4312
4313 - def GetPaletteInterpretation(self, *args):
4314 """GetPaletteInterpretation(ColorTable self) -> GDALPaletteInterp""" 4315 return _gdal.ColorTable_GetPaletteInterpretation(self, *args)
4316 4317
4318 - def GetCount(self, *args):
4319 """GetCount(ColorTable self) -> int""" 4320 return _gdal.ColorTable_GetCount(self, *args)
4321 4322
4323 - def GetColorEntry(self, *args):
4324 """GetColorEntry(ColorTable self, int entry) -> ColorEntry""" 4325 return _gdal.ColorTable_GetColorEntry(self, *args)
4326 4327
4328 - def GetColorEntryAsRGB(self, *args):
4329 """GetColorEntryAsRGB(ColorTable self, int entry, ColorEntry centry) -> int""" 4330 return _gdal.ColorTable_GetColorEntryAsRGB(self, *args)
4331 4332
4333 - def SetColorEntry(self, *args):
4334 """SetColorEntry(ColorTable self, int entry, ColorEntry centry)""" 4335 return _gdal.ColorTable_SetColorEntry(self, *args)
4336 4337
4338 - def CreateColorRamp(self, *args):
4339 """CreateColorRamp(ColorTable self, int nStartIndex, ColorEntry startcolor, int nEndIndex, ColorEntry endcolor)""" 4340 return _gdal.ColorTable_CreateColorRamp(self, *args)
4341 4342 ColorTable_swigregister = _gdal.ColorTable_swigregister 4343 ColorTable_swigregister(ColorTable) 4344
4345 -class RasterAttributeTable(_object):
4346 """Proxy of C++ GDALRasterAttributeTableShadow class.""" 4347 4348 __swig_setmethods__ = {} 4349 __setattr__ = lambda self, name, value: _swig_setattr(self, RasterAttributeTable, name, value) 4350 __swig_getmethods__ = {} 4351 __getattr__ = lambda self, name: _swig_getattr(self, RasterAttributeTable, name) 4352 __repr__ = _swig_repr 4353
4354 - def __init__(self, *args):
4355 """__init__(GDALRasterAttributeTableShadow self) -> RasterAttributeTable""" 4356 this = _gdal.new_RasterAttributeTable(*args) 4357 try: 4358 self.this.append(this) 4359 except __builtin__.Exception: 4360 self.this = this
4361 __swig_destroy__ = _gdal.delete_RasterAttributeTable 4362 __del__ = lambda self: None 4363
4364 - def Clone(self, *args):
4365 """Clone(RasterAttributeTable self) -> RasterAttributeTable""" 4366 return _gdal.RasterAttributeTable_Clone(self, *args)
4367 4368
4369 - def GetColumnCount(self, *args):
4370 """GetColumnCount(RasterAttributeTable self) -> int""" 4371 return _gdal.RasterAttributeTable_GetColumnCount(self, *args)
4372 4373
4374 - def GetNameOfCol(self, *args):
4375 """GetNameOfCol(RasterAttributeTable self, int iCol) -> char const *""" 4376 return _gdal.RasterAttributeTable_GetNameOfCol(self, *args)
4377 4378
4379 - def GetUsageOfCol(self, *args):
4380 """GetUsageOfCol(RasterAttributeTable self, int iCol) -> GDALRATFieldUsage""" 4381 return _gdal.RasterAttributeTable_GetUsageOfCol(self, *args)
4382 4383
4384 - def GetTypeOfCol(self, *args):
4385 """GetTypeOfCol(RasterAttributeTable self, int iCol) -> GDALRATFieldType""" 4386 return _gdal.RasterAttributeTable_GetTypeOfCol(self, *args)
4387 4388
4389 - def GetColOfUsage(self, *args):
4390 """GetColOfUsage(RasterAttributeTable self, GDALRATFieldUsage eUsage) -> int""" 4391 return _gdal.RasterAttributeTable_GetColOfUsage(self, *args)
4392 4393
4394 - def GetRowCount(self, *args):
4395 """GetRowCount(RasterAttributeTable self) -> int""" 4396 return _gdal.RasterAttributeTable_GetRowCount(self, *args)
4397 4398
4399 - def GetValueAsString(self, *args):
4400 """GetValueAsString(RasterAttributeTable self, int iRow, int iCol) -> char const *""" 4401 return _gdal.RasterAttributeTable_GetValueAsString(self, *args)
4402 4403
4404 - def GetValueAsInt(self, *args):
4405 """GetValueAsInt(RasterAttributeTable self, int iRow, int iCol) -> int""" 4406 return _gdal.RasterAttributeTable_GetValueAsInt(self, *args)
4407 4408
4409 - def GetValueAsDouble(self, *args):
4410 """GetValueAsDouble(RasterAttributeTable self, int iRow, int iCol) -> double""" 4411 return _gdal.RasterAttributeTable_GetValueAsDouble(self, *args)
4412 4413
4414 - def SetValueAsString(self, *args):
4415 """SetValueAsString(RasterAttributeTable self, int iRow, int iCol, char const * pszValue)""" 4416 return _gdal.RasterAttributeTable_SetValueAsString(self, *args)
4417 4418
4419 - def SetValueAsInt(self, *args):
4420 """SetValueAsInt(RasterAttributeTable self, int iRow, int iCol, int nValue)""" 4421 return _gdal.RasterAttributeTable_SetValueAsInt(self, *args)
4422 4423
4424 - def SetValueAsDouble(self, *args):
4425 """SetValueAsDouble(RasterAttributeTable self, int iRow, int iCol, double dfValue)""" 4426 return _gdal.RasterAttributeTable_SetValueAsDouble(self, *args)
4427 4428
4429 - def SetRowCount(self, *args):
4430 """SetRowCount(RasterAttributeTable self, int nCount)""" 4431 return _gdal.RasterAttributeTable_SetRowCount(self, *args)
4432 4433
4434 - def CreateColumn(self, *args):
4435 """CreateColumn(RasterAttributeTable self, char const * pszName, GDALRATFieldType eType, GDALRATFieldUsage eUsage) -> int""" 4436 return _gdal.RasterAttributeTable_CreateColumn(self, *args)
4437 4438
4439 - def GetLinearBinning(self, *args):
4440 """GetLinearBinning(RasterAttributeTable self) -> bool""" 4441 return _gdal.RasterAttributeTable_GetLinearBinning(self, *args)
4442 4443
4444 - def SetLinearBinning(self, *args):
4445 """SetLinearBinning(RasterAttributeTable self, double dfRow0Min, double dfBinSize) -> int""" 4446 return _gdal.RasterAttributeTable_SetLinearBinning(self, *args)
4447 4448
4449 - def GetRowOfValue(self, *args):
4450 """GetRowOfValue(RasterAttributeTable self, double dfValue) -> int""" 4451 return _gdal.RasterAttributeTable_GetRowOfValue(self, *args)
4452 4453
4454 - def ChangesAreWrittenToFile(self, *args):
4455 """ChangesAreWrittenToFile(RasterAttributeTable self) -> int""" 4456 return _gdal.RasterAttributeTable_ChangesAreWrittenToFile(self, *args)
4457 4458
4459 - def DumpReadable(self, *args):
4460 """DumpReadable(RasterAttributeTable self)""" 4461 return _gdal.RasterAttributeTable_DumpReadable(self, *args)
4462 4463
4464 - def SetTableType(self, *args):
4465 """SetTableType(RasterAttributeTable self, GDALRATTableType eTableType)""" 4466 return _gdal.RasterAttributeTable_SetTableType(self, *args)
4467 4468
4469 - def GetTableType(self, *args):
4470 """GetTableType(RasterAttributeTable self) -> GDALRATTableType""" 4471 return _gdal.RasterAttributeTable_GetTableType(self, *args)
4472 4473
4474 - def WriteArray(self, array, field, start=0):
4475 from osgeo import gdal_array 4476 4477 return gdal_array.RATWriteArray(self, array, field, start)
4478
4479 - def ReadAsArray(self, field, start=0, length=None):
4480 from osgeo import gdal_array 4481 4482 return gdal_array.RATReadArray(self, field, start, length)
4483 4484 RasterAttributeTable_swigregister = _gdal.RasterAttributeTable_swigregister 4485 RasterAttributeTable_swigregister(RasterAttributeTable) 4486 4487
4488 -def TermProgress_nocb(*args, **kwargs):
4489 """TermProgress_nocb(double dfProgress, char const * pszMessage=None, void * pData=None) -> int""" 4490 return _gdal.TermProgress_nocb(*args, **kwargs)
4491 TermProgress = _gdal.TermProgress 4492
4493 -def ComputeMedianCutPCT(*args, **kwargs):
4494 """ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4495 return _gdal.ComputeMedianCutPCT(*args, **kwargs)
4496
4497 -def DitherRGB2PCT(*args, **kwargs):
4498 """DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4499 return _gdal.DitherRGB2PCT(*args, **kwargs)
4500
4501 -def ReprojectImage(*args, **kwargs):
4502 """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""" 4503 return _gdal.ReprojectImage(*args, **kwargs)
4504
4505 -def ComputeProximity(*args, **kwargs):
4506 """ComputeProximity(Band srcBand, Band proximityBand, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4507 return _gdal.ComputeProximity(*args, **kwargs)
4508
4509 -def RasterizeLayer(*args, **kwargs):
4510 """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""" 4511 return _gdal.RasterizeLayer(*args, **kwargs)
4512
4513 -def Polygonize(*args, **kwargs):
4514 """Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4515 return _gdal.Polygonize(*args, **kwargs)
4516
4517 -def FPolygonize(*args, **kwargs):
4518 """FPolygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4519 return _gdal.FPolygonize(*args, **kwargs)
4520
4521 -def FillNodata(*args, **kwargs):
4522 """FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4523 return _gdal.FillNodata(*args, **kwargs)
4524
4525 -def SieveFilter(*args, **kwargs):
4526 """SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness=4, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4527 return _gdal.SieveFilter(*args, **kwargs)
4528
4529 -def RegenerateOverviews(*args, **kwargs):
4530 """RegenerateOverviews(Band srcBand, int overviewBandCount, char const * resampling, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4531 return _gdal.RegenerateOverviews(*args, **kwargs)
4532
4533 -def RegenerateOverview(*args, **kwargs):
4534 """RegenerateOverview(Band srcBand, Band overviewBand, char const * resampling, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4535 return _gdal.RegenerateOverview(*args, **kwargs)
4536
4537 -def ContourGenerate(*args, **kwargs):
4538 """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""" 4539 return _gdal.ContourGenerate(*args, **kwargs)
4540
4541 -def ContourGenerateEx(*args, **kwargs):
4542 """ContourGenerateEx(Band srcBand, Layer dstLayer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4543 return _gdal.ContourGenerateEx(*args, **kwargs)
4544 GVM_Diagonal = _gdal.GVM_Diagonal 4545 GVM_Edge = _gdal.GVM_Edge 4546 GVM_Max = _gdal.GVM_Max 4547 GVM_Min = _gdal.GVM_Min 4548 GVOT_NORMAL = _gdal.GVOT_NORMAL 4549 GVOT_MIN_TARGET_HEIGHT_FROM_DEM = _gdal.GVOT_MIN_TARGET_HEIGHT_FROM_DEM 4550 GVOT_MIN_TARGET_HEIGHT_FROM_GROUND = _gdal.GVOT_MIN_TARGET_HEIGHT_FROM_GROUND 4551
4552 -def ViewshedGenerate(*args, **kwargs):
4553 """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""" 4554 return _gdal.ViewshedGenerate(*args, **kwargs)
4555
4556 -def AutoCreateWarpedVRT(*args):
4557 """AutoCreateWarpedVRT(Dataset src_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg, double maxerror=0.0) -> Dataset""" 4558 return _gdal.AutoCreateWarpedVRT(*args)
4559
4560 -def CreatePansharpenedVRT(*args):
4561 """CreatePansharpenedVRT(char const * pszXML, Band panchroBand, int nInputSpectralBands) -> Dataset""" 4562 return _gdal.CreatePansharpenedVRT(*args)
4563 -class GDALTransformerInfoShadow(_object):
4564 """Proxy of C++ GDALTransformerInfoShadow class.""" 4565 4566 __swig_setmethods__ = {} 4567 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALTransformerInfoShadow, name, value) 4568 __swig_getmethods__ = {} 4569 __getattr__ = lambda self, name: _swig_getattr(self, GDALTransformerInfoShadow, name) 4570
4571 - def __init__(self, *args, **kwargs):
4572 raise AttributeError("No constructor defined")
4573 __repr__ = _swig_repr 4574 __swig_destroy__ = _gdal.delete_GDALTransformerInfoShadow 4575 __del__ = lambda self: None 4576
4577 - def TransformPoint(self, *args):
4578 """ 4579 TransformPoint(GDALTransformerInfoShadow self, int bDstToSrc, double [3] inout) -> int 4580 TransformPoint(GDALTransformerInfoShadow self, int bDstToSrc, double x, double y, double z=0.0) -> int 4581 """ 4582 return _gdal.GDALTransformerInfoShadow_TransformPoint(self, *args)
4583 4584
4585 - def TransformPoints(self, *args):
4586 """TransformPoints(GDALTransformerInfoShadow self, int bDstToSrc, int nCount) -> int""" 4587 return _gdal.GDALTransformerInfoShadow_TransformPoints(self, *args)
4588 4589
4590 - def TransformGeolocations(self, *args, **kwargs):
4591 """TransformGeolocations(GDALTransformerInfoShadow self, Band xBand, Band yBand, Band zBand, GDALProgressFunc callback=0, void * callback_data=None, char ** options=None) -> int""" 4592 return _gdal.GDALTransformerInfoShadow_TransformGeolocations(self, *args, **kwargs)
4593 4594 GDALTransformerInfoShadow_swigregister = _gdal.GDALTransformerInfoShadow_swigregister 4595 GDALTransformerInfoShadow_swigregister(GDALTransformerInfoShadow) 4596 4597
4598 -def Transformer(*args):
4599 """Transformer(Dataset src, Dataset dst, char ** options) -> GDALTransformerInfoShadow""" 4600 return _gdal.Transformer(*args)
4601
4602 -def _ApplyVerticalShiftGrid(*args, **kwargs):
4603 """_ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) -> Dataset""" 4604 return _gdal._ApplyVerticalShiftGrid(*args, **kwargs)
4605
4606 -def ApplyGeoTransform(*args):
4607 """ApplyGeoTransform(double [6] padfGeoTransform, double dfPixel, double dfLine)""" 4608 return _gdal.ApplyGeoTransform(*args)
4609
4610 -def InvGeoTransform(*args):
4611 """InvGeoTransform(double [6] gt_in) -> RETURN_NONE""" 4612 return _gdal.InvGeoTransform(*args)
4613
4614 -def VersionInfo(*args):
4615 """VersionInfo(char const * request) -> char const *""" 4616 return _gdal.VersionInfo(*args)
4617
4618 -def AllRegister(*args):
4619 """AllRegister()""" 4620 return _gdal.AllRegister(*args)
4621
4622 -def GDALDestroyDriverManager(*args):
4623 """GDALDestroyDriverManager()""" 4624 return _gdal.GDALDestroyDriverManager(*args)
4625
4626 -def GetCacheMax(*args):
4627 """GetCacheMax() -> GIntBig""" 4628 return _gdal.GetCacheMax(*args)
4629
4630 -def GetCacheUsed(*args):
4631 """GetCacheUsed() -> GIntBig""" 4632 return _gdal.GetCacheUsed(*args)
4633
4634 -def SetCacheMax(*args):
4635 """SetCacheMax(GIntBig nBytes)""" 4636 return _gdal.SetCacheMax(*args)
4637
4638 -def GetDataTypeSize(*args):
4639 """GetDataTypeSize(GDALDataType eDataType) -> int""" 4640 return _gdal.GetDataTypeSize(*args)
4641
4642 -def DataTypeIsComplex(*args):
4643 """DataTypeIsComplex(GDALDataType eDataType) -> int""" 4644 return _gdal.DataTypeIsComplex(*args)
4645
4646 -def GetDataTypeName(*args):
4647 """GetDataTypeName(GDALDataType eDataType) -> char const *""" 4648 return _gdal.GetDataTypeName(*args)
4649
4650 -def GetDataTypeByName(*args):
4651 """GetDataTypeByName(char const * pszDataTypeName) -> GDALDataType""" 4652 return _gdal.GetDataTypeByName(*args)
4653
4654 -def DataTypeUnion(*args):
4655 """DataTypeUnion(GDALDataType a, GDALDataType b) -> GDALDataType""" 4656 return _gdal.DataTypeUnion(*args)
4657
4658 -def GetColorInterpretationName(*args):
4659 """GetColorInterpretationName(GDALColorInterp eColorInterp) -> char const *""" 4660 return _gdal.GetColorInterpretationName(*args)
4661
4662 -def GetPaletteInterpretationName(*args):
4663 """GetPaletteInterpretationName(GDALPaletteInterp ePaletteInterp) -> char const *""" 4664 return _gdal.GetPaletteInterpretationName(*args)
4665
4666 -def DecToDMS(*args):
4667 """DecToDMS(double arg1, char const * arg2, int arg3=2) -> char const *""" 4668 return _gdal.DecToDMS(*args)
4669
4670 -def PackedDMSToDec(*args):
4671 """PackedDMSToDec(double dfPacked) -> double""" 4672 return _gdal.PackedDMSToDec(*args)
4673
4674 -def DecToPackedDMS(*args):
4675 """DecToPackedDMS(double dfDec) -> double""" 4676 return _gdal.DecToPackedDMS(*args)
4677
4678 -def ParseXMLString(*args):
4679 """ParseXMLString(char * pszXMLString) -> CPLXMLNode *""" 4680 return _gdal.ParseXMLString(*args)
4681
4682 -def SerializeXMLTree(*args):
4683 """SerializeXMLTree(CPLXMLNode * xmlnode) -> retStringAndCPLFree *""" 4684 return _gdal.SerializeXMLTree(*args)
4685
4686 -def GetJPEG2000Structure(*args):
4687 """GetJPEG2000Structure(char const * pszFilename, char ** options=None) -> CPLXMLNode *""" 4688 return _gdal.GetJPEG2000Structure(*args)
4689
4690 -def GetJPEG2000StructureAsString(*args):
4691 """GetJPEG2000StructureAsString(char const * pszFilename, char ** options=None) -> retStringAndCPLFree *""" 4692 return _gdal.GetJPEG2000StructureAsString(*args)
4693
4694 -def GetDriverCount(*args):
4695 """GetDriverCount() -> int""" 4696 return _gdal.GetDriverCount(*args)
4697
4698 -def GetDriverByName(*args):
4699 """GetDriverByName(char const * name) -> Driver""" 4700 return _gdal.GetDriverByName(*args)
4701
4702 -def GetDriver(*args):
4703 """GetDriver(int i) -> Driver""" 4704 return _gdal.GetDriver(*args)
4705
4706 -def Open(*args):
4707 """Open(char const * utf8_path, GDALAccess eAccess) -> Dataset""" 4708 return _gdal.Open(*args)
4709
4710 -def OpenEx(*args, **kwargs):
4711 """OpenEx(char const * utf8_path, unsigned int nOpenFlags=0, char ** allowed_drivers=None, char ** open_options=None, char ** sibling_files=None) -> Dataset""" 4712 return _gdal.OpenEx(*args, **kwargs)
4713
4714 -def OpenShared(*args):
4715 """OpenShared(char const * utf8_path, GDALAccess eAccess) -> Dataset""" 4716 return _gdal.OpenShared(*args)
4717
4718 -def IdentifyDriver(*args):
4719 """IdentifyDriver(char const * utf8_path, char ** papszSiblings=None) -> Driver""" 4720 return _gdal.IdentifyDriver(*args)
4721
4722 -def IdentifyDriverEx(*args, **kwargs):
4723 """IdentifyDriverEx(char const * utf8_path, unsigned int nIdentifyFlags=0, char ** allowed_drivers=None, char ** sibling_files=None) -> Driver""" 4724 return _gdal.IdentifyDriverEx(*args, **kwargs)
4725
4726 -def GeneralCmdLineProcessor(*args):
4727 """GeneralCmdLineProcessor(char ** papszArgv, int nOptions=0) -> char **""" 4728 return _gdal.GeneralCmdLineProcessor(*args)
4729 4730 __version__ = _gdal.VersionInfo("RELEASE_NAME") 4731
4732 -class GDALInfoOptions(_object):
4733 """Proxy of C++ GDALInfoOptions class.""" 4734 4735 __swig_setmethods__ = {} 4736 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALInfoOptions, name, value) 4737 __swig_getmethods__ = {} 4738 __getattr__ = lambda self, name: _swig_getattr(self, GDALInfoOptions, name) 4739 __repr__ = _swig_repr 4740
4741 - def __init__(self, *args):
4742 """__init__(GDALInfoOptions self, char ** options) -> GDALInfoOptions""" 4743 this = _gdal.new_GDALInfoOptions(*args) 4744 try: 4745 self.this.append(this) 4746 except __builtin__.Exception: 4747 self.this = this
4748 __swig_destroy__ = _gdal.delete_GDALInfoOptions 4749 __del__ = lambda self: None
4750 GDALInfoOptions_swigregister = _gdal.GDALInfoOptions_swigregister 4751 GDALInfoOptions_swigregister(GDALInfoOptions) 4752 4753
4754 -def InfoInternal(*args):
4755 """InfoInternal(Dataset hDataset, GDALInfoOptions infoOptions) -> retStringAndCPLFree *""" 4756 return _gdal.InfoInternal(*args)
4757 -class GDALMultiDimInfoOptions(_object):
4758 """Proxy of C++ GDALMultiDimInfoOptions class.""" 4759 4760 __swig_setmethods__ = {} 4761 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALMultiDimInfoOptions, name, value) 4762 __swig_getmethods__ = {} 4763 __getattr__ = lambda self, name: _swig_getattr(self, GDALMultiDimInfoOptions, name) 4764 __repr__ = _swig_repr 4765
4766 - def __init__(self, *args):
4767 """__init__(GDALMultiDimInfoOptions self, char ** options) -> GDALMultiDimInfoOptions""" 4768 this = _gdal.new_GDALMultiDimInfoOptions(*args) 4769 try: 4770 self.this.append(this) 4771 except __builtin__.Exception: 4772 self.this = this
4773 __swig_destroy__ = _gdal.delete_GDALMultiDimInfoOptions 4774 __del__ = lambda self: None
4775 GDALMultiDimInfoOptions_swigregister = _gdal.GDALMultiDimInfoOptions_swigregister 4776 GDALMultiDimInfoOptions_swigregister(GDALMultiDimInfoOptions) 4777 4778
4779 -def MultiDimInfoInternal(*args):
4780 """MultiDimInfoInternal(Dataset hDataset, GDALMultiDimInfoOptions infoOptions) -> retStringAndCPLFree *""" 4781 return _gdal.MultiDimInfoInternal(*args)
4782 -class GDALTranslateOptions(_object):
4783 """Proxy of C++ GDALTranslateOptions class.""" 4784 4785 __swig_setmethods__ = {} 4786 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALTranslateOptions, name, value) 4787 __swig_getmethods__ = {} 4788 __getattr__ = lambda self, name: _swig_getattr(self, GDALTranslateOptions, name) 4789 __repr__ = _swig_repr 4790
4791 - def __init__(self, *args):
4792 """__init__(GDALTranslateOptions self, char ** options) -> GDALTranslateOptions""" 4793 this = _gdal.new_GDALTranslateOptions(*args) 4794 try: 4795 self.this.append(this) 4796 except __builtin__.Exception: 4797 self.this = this
4798 __swig_destroy__ = _gdal.delete_GDALTranslateOptions 4799 __del__ = lambda self: None
4800 GDALTranslateOptions_swigregister = _gdal.GDALTranslateOptions_swigregister 4801 GDALTranslateOptions_swigregister(GDALTranslateOptions) 4802 4803
4804 -def TranslateInternal(*args):
4805 """TranslateInternal(char const * dest, Dataset dataset, GDALTranslateOptions translateOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4806 return _gdal.TranslateInternal(*args)
4807 -class GDALWarpAppOptions(_object):
4808 """Proxy of C++ GDALWarpAppOptions class.""" 4809 4810 __swig_setmethods__ = {} 4811 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALWarpAppOptions, name, value) 4812 __swig_getmethods__ = {} 4813 __getattr__ = lambda self, name: _swig_getattr(self, GDALWarpAppOptions, name) 4814 __repr__ = _swig_repr 4815
4816 - def __init__(self, *args):
4817 """__init__(GDALWarpAppOptions self, char ** options) -> GDALWarpAppOptions""" 4818 this = _gdal.new_GDALWarpAppOptions(*args) 4819 try: 4820 self.this.append(this) 4821 except __builtin__.Exception: 4822 self.this = this
4823 __swig_destroy__ = _gdal.delete_GDALWarpAppOptions 4824 __del__ = lambda self: None
4825 GDALWarpAppOptions_swigregister = _gdal.GDALWarpAppOptions_swigregister 4826 GDALWarpAppOptions_swigregister(GDALWarpAppOptions) 4827 4828
4829 -def wrapper_GDALWarpDestDS(*args):
4830 """wrapper_GDALWarpDestDS(Dataset dstDS, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4831 return _gdal.wrapper_GDALWarpDestDS(*args)
4832
4833 -def wrapper_GDALWarpDestName(*args):
4834 """wrapper_GDALWarpDestName(char const * dest, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4835 return _gdal.wrapper_GDALWarpDestName(*args)
4836 -class GDALVectorTranslateOptions(_object):
4837 """Proxy of C++ GDALVectorTranslateOptions class.""" 4838 4839 __swig_setmethods__ = {} 4840 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALVectorTranslateOptions, name, value) 4841 __swig_getmethods__ = {} 4842 __getattr__ = lambda self, name: _swig_getattr(self, GDALVectorTranslateOptions, name) 4843 __repr__ = _swig_repr 4844
4845 - def __init__(self, *args):
4846 """__init__(GDALVectorTranslateOptions self, char ** options) -> GDALVectorTranslateOptions""" 4847 this = _gdal.new_GDALVectorTranslateOptions(*args) 4848 try: 4849 self.this.append(this) 4850 except __builtin__.Exception: 4851 self.this = this
4852 __swig_destroy__ = _gdal.delete_GDALVectorTranslateOptions 4853 __del__ = lambda self: None
4854 GDALVectorTranslateOptions_swigregister = _gdal.GDALVectorTranslateOptions_swigregister 4855 GDALVectorTranslateOptions_swigregister(GDALVectorTranslateOptions) 4856 4857
4858 -def wrapper_GDALVectorTranslateDestDS(*args):
4859 """wrapper_GDALVectorTranslateDestDS(Dataset dstDS, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4860 return _gdal.wrapper_GDALVectorTranslateDestDS(*args)
4861
4862 -def wrapper_GDALVectorTranslateDestName(*args):
4863 """wrapper_GDALVectorTranslateDestName(char const * dest, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4864 return _gdal.wrapper_GDALVectorTranslateDestName(*args)
4865 -class GDALDEMProcessingOptions(_object):
4866 """Proxy of C++ GDALDEMProcessingOptions class.""" 4867 4868 __swig_setmethods__ = {} 4869 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALDEMProcessingOptions, name, value) 4870 __swig_getmethods__ = {} 4871 __getattr__ = lambda self, name: _swig_getattr(self, GDALDEMProcessingOptions, name) 4872 __repr__ = _swig_repr 4873
4874 - def __init__(self, *args):
4875 """__init__(GDALDEMProcessingOptions self, char ** options) -> GDALDEMProcessingOptions""" 4876 this = _gdal.new_GDALDEMProcessingOptions(*args) 4877 try: 4878 self.this.append(this) 4879 except __builtin__.Exception: 4880 self.this = this
4881 __swig_destroy__ = _gdal.delete_GDALDEMProcessingOptions 4882 __del__ = lambda self: None
4883 GDALDEMProcessingOptions_swigregister = _gdal.GDALDEMProcessingOptions_swigregister 4884 GDALDEMProcessingOptions_swigregister(GDALDEMProcessingOptions) 4885 4886
4887 -def DEMProcessingInternal(*args):
4888 """DEMProcessingInternal(char const * dest, Dataset dataset, char const * pszProcessing, char const * pszColorFilename, GDALDEMProcessingOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4889 return _gdal.DEMProcessingInternal(*args)
4890 -class GDALNearblackOptions(_object):
4891 """Proxy of C++ GDALNearblackOptions class.""" 4892 4893 __swig_setmethods__ = {} 4894 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALNearblackOptions, name, value) 4895 __swig_getmethods__ = {} 4896 __getattr__ = lambda self, name: _swig_getattr(self, GDALNearblackOptions, name) 4897 __repr__ = _swig_repr 4898
4899 - def __init__(self, *args):
4900 """__init__(GDALNearblackOptions self, char ** options) -> GDALNearblackOptions""" 4901 this = _gdal.new_GDALNearblackOptions(*args) 4902 try: 4903 self.this.append(this) 4904 except __builtin__.Exception: 4905 self.this = this
4906 __swig_destroy__ = _gdal.delete_GDALNearblackOptions 4907 __del__ = lambda self: None
4908 GDALNearblackOptions_swigregister = _gdal.GDALNearblackOptions_swigregister 4909 GDALNearblackOptions_swigregister(GDALNearblackOptions) 4910 4911
4912 -def wrapper_GDALNearblackDestDS(*args):
4913 """wrapper_GDALNearblackDestDS(Dataset dstDS, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4914 return _gdal.wrapper_GDALNearblackDestDS(*args)
4915
4916 -def wrapper_GDALNearblackDestName(*args):
4917 """wrapper_GDALNearblackDestName(char const * dest, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4918 return _gdal.wrapper_GDALNearblackDestName(*args)
4919 -class GDALGridOptions(_object):
4920 """Proxy of C++ GDALGridOptions class.""" 4921 4922 __swig_setmethods__ = {} 4923 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALGridOptions, name, value) 4924 __swig_getmethods__ = {} 4925 __getattr__ = lambda self, name: _swig_getattr(self, GDALGridOptions, name) 4926 __repr__ = _swig_repr 4927
4928 - def __init__(self, *args):
4929 """__init__(GDALGridOptions self, char ** options) -> GDALGridOptions""" 4930 this = _gdal.new_GDALGridOptions(*args) 4931 try: 4932 self.this.append(this) 4933 except __builtin__.Exception: 4934 self.this = this
4935 __swig_destroy__ = _gdal.delete_GDALGridOptions 4936 __del__ = lambda self: None
4937 GDALGridOptions_swigregister = _gdal.GDALGridOptions_swigregister 4938 GDALGridOptions_swigregister(GDALGridOptions) 4939 4940
4941 -def GridInternal(*args):
4942 """GridInternal(char const * dest, Dataset dataset, GDALGridOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4943 return _gdal.GridInternal(*args)
4944 -class GDALRasterizeOptions(_object):
4945 """Proxy of C++ GDALRasterizeOptions class.""" 4946 4947 __swig_setmethods__ = {} 4948 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALRasterizeOptions, name, value) 4949 __swig_getmethods__ = {} 4950 __getattr__ = lambda self, name: _swig_getattr(self, GDALRasterizeOptions, name) 4951 __repr__ = _swig_repr 4952
4953 - def __init__(self, *args):
4954 """__init__(GDALRasterizeOptions self, char ** options) -> GDALRasterizeOptions""" 4955 this = _gdal.new_GDALRasterizeOptions(*args) 4956 try: 4957 self.this.append(this) 4958 except __builtin__.Exception: 4959 self.this = this
4960 __swig_destroy__ = _gdal.delete_GDALRasterizeOptions 4961 __del__ = lambda self: None
4962 GDALRasterizeOptions_swigregister = _gdal.GDALRasterizeOptions_swigregister 4963 GDALRasterizeOptions_swigregister(GDALRasterizeOptions) 4964 4965
4966 -def wrapper_GDALRasterizeDestDS(*args):
4967 """wrapper_GDALRasterizeDestDS(Dataset dstDS, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> int""" 4968 return _gdal.wrapper_GDALRasterizeDestDS(*args)
4969
4970 -def wrapper_GDALRasterizeDestName(*args):
4971 """wrapper_GDALRasterizeDestName(char const * dest, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4972 return _gdal.wrapper_GDALRasterizeDestName(*args)
4973 -class GDALBuildVRTOptions(_object):
4974 """Proxy of C++ GDALBuildVRTOptions class.""" 4975 4976 __swig_setmethods__ = {} 4977 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALBuildVRTOptions, name, value) 4978 __swig_getmethods__ = {} 4979 __getattr__ = lambda self, name: _swig_getattr(self, GDALBuildVRTOptions, name) 4980 __repr__ = _swig_repr 4981
4982 - def __init__(self, *args):
4983 """__init__(GDALBuildVRTOptions self, char ** options) -> GDALBuildVRTOptions""" 4984 this = _gdal.new_GDALBuildVRTOptions(*args) 4985 try: 4986 self.this.append(this) 4987 except __builtin__.Exception: 4988 self.this = this
4989 __swig_destroy__ = _gdal.delete_GDALBuildVRTOptions 4990 __del__ = lambda self: None
4991 GDALBuildVRTOptions_swigregister = _gdal.GDALBuildVRTOptions_swigregister 4992 GDALBuildVRTOptions_swigregister(GDALBuildVRTOptions) 4993 4994
4995 -def BuildVRTInternalObjects(*args):
4996 """BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 4997 return _gdal.BuildVRTInternalObjects(*args)
4998
4999 -def BuildVRTInternalNames(*args):
5000 """BuildVRTInternalNames(char const * dest, char ** source_filenames, GDALBuildVRTOptions options, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 5001 return _gdal.BuildVRTInternalNames(*args)
5002 -class GDALMultiDimTranslateOptions(_object):
5003 """Proxy of C++ GDALMultiDimTranslateOptions class.""" 5004 5005 __swig_setmethods__ = {} 5006 __setattr__ = lambda self, name, value: _swig_setattr(self, GDALMultiDimTranslateOptions, name, value) 5007 __swig_getmethods__ = {} 5008 __getattr__ = lambda self, name: _swig_getattr(self, GDALMultiDimTranslateOptions, name) 5009 __repr__ = _swig_repr 5010
5011 - def __init__(self, *args):
5012 """__init__(GDALMultiDimTranslateOptions self, char ** options) -> GDALMultiDimTranslateOptions""" 5013 this = _gdal.new_GDALMultiDimTranslateOptions(*args) 5014 try: 5015 self.this.append(this) 5016 except __builtin__.Exception: 5017 self.this = this
5018 __swig_destroy__ = _gdal.delete_GDALMultiDimTranslateOptions 5019 __del__ = lambda self: None
5020 GDALMultiDimTranslateOptions_swigregister = _gdal.GDALMultiDimTranslateOptions_swigregister 5021 GDALMultiDimTranslateOptions_swigregister(GDALMultiDimTranslateOptions) 5022 5023
5024 -def wrapper_GDALMultiDimTranslateDestName(*args):
5025 """wrapper_GDALMultiDimTranslateDestName(char const * dest, int object_list_count, GDALMultiDimTranslateOptions multiDimTranslateOptions, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 5026 return _gdal.wrapper_GDALMultiDimTranslateDestName(*args)
5027 # This file is compatible with both classic and new-style classes. 5028