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