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

Source Code for Module osgeo.gdal

   1  # This file was automatically generated by SWIG (http://www.swig.org). 
   2  # Version 3.0.12 
   3  # 
   4  # Do not make changes to this file unless you know what you are doing--modify 
   5  # the SWIG interface file instead. 
   6   
   7  from sys import version_info as _swig_python_version_info 
   8  if _swig_python_version_info >= (2, 7, 0): 
9 - def swig_import_helper():
10 import importlib 11 pkg = __name__.rpartition('.')[0] 12 mname = '.'.join((pkg, '_gdal')).lstrip('.') 13 try: 14 return importlib.import_module(mname) 15 except ImportError: 16 return importlib.import_module('_gdal')
17 _gdal = swig_import_helper() 18 del swig_import_helper 19 elif _swig_python_version_info >= (2, 6, 0):
20 - def swig_import_helper():
21 from os.path import dirname 22 import imp 23 fp = None 24 try: 25 fp, pathname, description = imp.find_module('_gdal', [dirname(__file__)]) 26 except ImportError: 27 import _gdal 28 return _gdal 29 try: 30 _mod = imp.load_module('_gdal', fp, pathname, description) 31 finally: 32 if fp is not None: 33 fp.close() 34 return _mod
35 _gdal = swig_import_helper() 36 del swig_import_helper 37 else: 38 import _gdal 39 del _swig_python_version_info 40 41 try: 42 _swig_property = property 43 except NameError: 44 pass # Python < 2.2 doesn't have 'property'. 45 46 try: 47 import builtins as __builtin__ 48 except ImportError: 49 import __builtin__ 50
51 -def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
52 if (name == "thisown"): 53 return self.this.own(value) 54 if (name == "this"): 55 if type(value).__name__ == 'SwigPyObject': 56 self.__dict__[name] = value 57 return 58 method = class_type.__swig_setmethods__.get(name, None) 59 if method: 60 return method(self, value) 61 if (not static): 62 if _newclass: 63 object.__setattr__(self, name, value) 64 else: 65 self.__dict__[name] = value 66 else: 67 raise AttributeError("You cannot add attributes to %s" % self)
68 69
70 -def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
72 73
74 -def _swig_getattr(self, class_type, name):
75 if (name == "thisown"): 76 return self.this.own() 77 method = class_type.__swig_getmethods__.get(name, None) 78 if method: 79 return method(self) 80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
81 82
83 -def _swig_repr(self):
84 try: 85 strthis = "proxy of " + self.this.__repr__() 86 except __builtin__.Exception: 87 strthis = "" 88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
89 90 try: 91 _object = object 92 _newclass = 1 93 except __builtin__.Exception:
94 - class _object:
95 pass
96 _newclass = 0 97 98 99 100 101 have_warned = 0
102 -def deprecation_warn(module, sub_package=None, new_module=None):
103 global have_warned 104 105 if have_warned == 1: 106 return 107 108 have_warned = 1 109 if sub_package is None or sub_package == 'utils': 110 sub_package = 'osgeo_utils' 111 if new_module is None: 112 new_module = module 113 new_module = '{}.{}'.format(sub_package, new_module) 114 115 from warnings import warn 116 warn('{}.py was placed in a namespace, it is now available as {}' .format(module, new_module), 117 DeprecationWarning)
118 119 120 from osgeo.gdalconst import * 121 from osgeo import gdalconst 122 123 124 import sys 125 byteorders = {"little": "<", 126 "big": ">"} 127 array_modes = { gdalconst.GDT_Int16: ("%si2" % byteorders[sys.byteorder]), 128 gdalconst.GDT_UInt16: ("%su2" % byteorders[sys.byteorder]), 129 gdalconst.GDT_Int32: ("%si4" % byteorders[sys.byteorder]), 130 gdalconst.GDT_UInt32: ("%su4" % byteorders[sys.byteorder]), 131 gdalconst.GDT_Float32: ("%sf4" % byteorders[sys.byteorder]), 132 gdalconst.GDT_Float64: ("%sf8" % byteorders[sys.byteorder]), 133 gdalconst.GDT_CFloat32: ("%sf4" % byteorders[sys.byteorder]), 134 gdalconst.GDT_CFloat64: ("%sf8" % byteorders[sys.byteorder]), 135 gdalconst.GDT_Byte: ("%st8" % byteorders[sys.byteorder]), 136 } 137
138 -def RGBFile2PCTFile( src_filename, dst_filename ):
139 src_ds = Open(src_filename) 140 if src_ds is None or src_ds == 'NULL': 141 return 1 142 143 ct = ColorTable() 144 err = ComputeMedianCutPCT(src_ds.GetRasterBand(1), 145 src_ds.GetRasterBand(2), 146 src_ds.GetRasterBand(3), 147 256, ct) 148 if err != 0: 149 return err 150 151 gtiff_driver = GetDriverByName('GTiff') 152 if gtiff_driver is None: 153 return 1 154 155 dst_ds = gtiff_driver.Create(dst_filename, 156 src_ds.RasterXSize, src_ds.RasterYSize) 157 dst_ds.GetRasterBand(1).SetRasterColorTable(ct) 158 159 err = DitherRGB2PCT(src_ds.GetRasterBand(1), 160 src_ds.GetRasterBand(2), 161 src_ds.GetRasterBand(3), 162 dst_ds.GetRasterBand(1), 163 ct) 164 dst_ds = None 165 src_ds = None 166 167 return 0
168
169 -def listdir(path, recursionLevel = -1, options = []):
170 """ Iterate over a directory. 171 172 recursionLevel = -1 means unlimited level of recursion. 173 """ 174 dir = OpenDir(path, recursionLevel, options) 175 if not dir: 176 raise OSError(path + ' does not exist') 177 try: 178 while True: 179 entry = GetNextDirEntry(dir) 180 if not entry: 181 break 182 yield entry 183 finally: 184 CloseDir(dir)
185 186
187 -def GetUseExceptions(*args):
188 """GetUseExceptions() -> int""" 189 return _gdal.GetUseExceptions(*args)
190
191 -def UseExceptions(*args):
192 """UseExceptions()""" 193 return _gdal.UseExceptions(*args)
194
195 -def DontUseExceptions(*args):
196 """DontUseExceptions()""" 197 return _gdal.DontUseExceptions(*args)
198
199 -def VSIFReadL(*args):
200 """VSIFReadL(unsigned int nMembSize, unsigned int nMembCount, VSILFILE fp) -> unsigned int""" 201 return _gdal.VSIFReadL(*args)
202
203 -def VSIGetMemFileBuffer_unsafe(*args):
204 """VSIGetMemFileBuffer_unsafe(char const * utf8_path)""" 205 return _gdal.VSIGetMemFileBuffer_unsafe(*args)
206 207
208 -def InfoOptions(options=None, format='text', deserialize=True, 209 computeMinMax=False, reportHistograms=False, reportProj4=False, 210 stats=False, approxStats=False, computeChecksum=False, 211 showGCPs=True, showMetadata=True, showRAT=True, showColorTable=True, 212 listMDD=False, showFileList=True, allMetadata=False, 213 extraMDDomains=None, wktFormat=None):
214 """ Create a InfoOptions() object that can be passed to gdal.Info() 215 options can be be an array of strings, a string or let empty and filled from other keywords.""" 216 217 options = [] if options is None else options 218 219 if isinstance(options, str): 220 new_options = ParseCommandLine(options) 221 format = 'text' 222 if '-json' in new_options: 223 format = 'json' 224 else: 225 new_options = options 226 if format == 'json': 227 new_options += ['-json'] 228 if '-json' in new_options: 229 format = 'json' 230 if computeMinMax: 231 new_options += ['-mm'] 232 if reportHistograms: 233 new_options += ['-hist'] 234 if reportProj4: 235 new_options += ['-proj4'] 236 if stats: 237 new_options += ['-stats'] 238 if approxStats: 239 new_options += ['-approx_stats'] 240 if computeChecksum: 241 new_options += ['-checksum'] 242 if not showGCPs: 243 new_options += ['-nogcp'] 244 if not showMetadata: 245 new_options += ['-nomd'] 246 if not showRAT: 247 new_options += ['-norat'] 248 if not showColorTable: 249 new_options += ['-noct'] 250 if listMDD: 251 new_options += ['-listmdd'] 252 if not showFileList: 253 new_options += ['-nofl'] 254 if allMetadata: 255 new_options += ['-mdd', 'all'] 256 if wktFormat: 257 new_options += ['-wkt_format', wktFormat] 258 if extraMDDomains is not None: 259 for mdd in extraMDDomains: 260 new_options += ['-mdd', mdd] 261 262 return (GDALInfoOptions(new_options), format, deserialize)
263
264 -def Info(ds, **kwargs):
265 """ Return information on a dataset. 266 Arguments are : 267 ds --- a Dataset object or a filename 268 Keyword arguments are : 269 options --- return of gdal.InfoOptions(), string or array of strings 270 other keywords arguments of gdal.InfoOptions() 271 If options is provided as a gdal.InfoOptions() object, other keywords are ignored. """ 272 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 273 (opts, format, deserialize) = InfoOptions(**kwargs) 274 else: 275 (opts, format, deserialize) = kwargs['options'] 276 if isinstance(ds, str): 277 ds = Open(ds) 278 ret = InfoInternal(ds, opts) 279 if format == 'json' and deserialize: 280 import json 281 ret = json.loads(ret) 282 return ret
283 284
285 -def MultiDimInfoOptions(options=None, detailed=False, array=None, arrayoptions=None, limit=None, as_text=False):
286 """ Create a MultiDimInfoOptions() object that can be passed to gdal.MultiDimInfo() 287 options can be be an array of strings, a string or let empty and filled from other keywords.""" 288 289 options = [] if options is None else options 290 291 if isinstance(options, str): 292 new_options = ParseCommandLine(options) 293 else: 294 new_options = options 295 if detailed: 296 new_options += ['-detailed'] 297 if array: 298 new_options += ['-array', array] 299 if limit: 300 new_options += ['-limit', str(limit)] 301 if arrayoptions: 302 for option in arrayoptions: 303 new_options += ['-arrayoption', option] 304 305 return GDALMultiDimInfoOptions(new_options), as_text
306
307 -def MultiDimInfo(ds, **kwargs):
308 """ Return information on a dataset. 309 Arguments are : 310 ds --- a Dataset object or a filename 311 Keyword arguments are : 312 options --- return of gdal.MultiDimInfoOptions(), string or array of strings 313 other keywords arguments of gdal.MultiDimInfoOptions() 314 If options is provided as a gdal.MultiDimInfoOptions() object, other keywords are ignored. """ 315 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 316 opts, as_text = MultiDimInfoOptions(**kwargs) 317 else: 318 opts = kwargs['options'] 319 as_text = True 320 if isinstance(ds, str): 321 ds = OpenEx(ds, OF_VERBOSE_ERROR | OF_MULTIDIM_RASTER) 322 ret = MultiDimInfoInternal(ds, opts) 323 if not as_text: 324 import json 325 ret = json.loads(ret) 326 return ret
327 328
329 -def _strHighPrec(x):
330 return ('%.18g' % x) if isinstance(x, float) else str(x)
331 332 mapGRIORAMethodToString = { 333 gdalconst.GRIORA_NearestNeighbour: 'near', 334 gdalconst.GRIORA_Bilinear: 'bilinear', 335 gdalconst.GRIORA_Cubic: 'cubic', 336 gdalconst.GRIORA_CubicSpline: 'cubicspline', 337 gdalconst.GRIORA_Lanczos: 'lanczos', 338 gdalconst.GRIORA_Average: 'average', 339 gdalconst.GRIORA_RMS: 'rms', 340 gdalconst.GRIORA_Mode: 'mode', 341 gdalconst.GRIORA_Gauss: 'gauss', 342 } 343
344 -def TranslateOptions(options=None, format=None, 345 outputType = gdalconst.GDT_Unknown, bandList=None, maskBand=None, 346 width = 0, height = 0, widthPct = 0.0, heightPct = 0.0, 347 xRes = 0.0, yRes = 0.0, 348 creationOptions=None, srcWin=None, projWin=None, projWinSRS=None, strict = False, 349 unscale = False, scaleParams=None, exponents=None, 350 outputBounds=None, metadataOptions=None, 351 outputSRS=None, nogcp=False, GCPs=None, 352 noData=None, rgbExpand=None, 353 stats = False, rat = True, xmp = True, resampleAlg=None, 354 callback=None, callback_data=None):
355 """ Create a TranslateOptions() object that can be passed to gdal.Translate() 356 Keyword arguments are : 357 options --- can be be an array of strings, a string or let empty and filled from other keywords. 358 format --- output format ("GTiff", etc...) 359 outputType --- output type (gdalconst.GDT_Byte, etc...) 360 bandList --- array of band numbers (index start at 1) 361 maskBand --- mask band to generate or not ("none", "auto", "mask", 1, ...) 362 width --- width of the output raster in pixel 363 height --- height of the output raster in pixel 364 widthPct --- width of the output raster in percentage (100 = original width) 365 heightPct --- height of the output raster in percentage (100 = original height) 366 xRes --- output horizontal resolution 367 yRes --- output vertical resolution 368 creationOptions --- list of creation options 369 srcWin --- subwindow in pixels to extract: [left_x, top_y, width, height] 370 projWin --- subwindow in projected coordinates to extract: [ulx, uly, lrx, lry] 371 projWinSRS --- SRS in which projWin is expressed 372 strict --- strict mode 373 unscale --- unscale values with scale and offset metadata 374 scaleParams --- list of scale parameters, each of the form [src_min,src_max] or [src_min,src_max,dst_min,dst_max] 375 exponents --- list of exponentiation parameters 376 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry] 377 metadataOptions --- list of metadata options 378 outputSRS --- assigned output SRS 379 nogcp --- ignore GCP in the raster 380 GCPs --- list of GCPs 381 noData --- nodata value (or "none" to unset it) 382 rgbExpand --- Color palette expansion mode: "gray", "rgb", "rgba" 383 stats --- whether to calculate statistics 384 rat --- whether to write source RAT 385 xmp --- whether to copy XMP metadata 386 resampleAlg --- resampling mode 387 callback --- callback method 388 callback_data --- user data for callback 389 """ 390 391 # Only used for tests 392 return_option_list = options == '__RETURN_OPTION_LIST__' 393 if return_option_list: 394 options = [] 395 else: 396 options = [] if options is None else options 397 398 if isinstance(options, str): 399 new_options = ParseCommandLine(options) 400 else: 401 new_options = options 402 if format is not None: 403 new_options += ['-of', format] 404 if outputType != gdalconst.GDT_Unknown: 405 new_options += ['-ot', GetDataTypeName(outputType)] 406 if maskBand != None: 407 new_options += ['-mask', str(maskBand)] 408 if bandList != None: 409 for b in bandList: 410 new_options += ['-b', str(b)] 411 if width != 0 or height != 0: 412 new_options += ['-outsize', str(width), str(height)] 413 elif widthPct != 0 and heightPct != 0: 414 new_options += ['-outsize', str(widthPct) + '%%', str(heightPct) + '%%'] 415 if creationOptions is not None: 416 if isinstance(creationOptions, str): 417 new_options += ['-co', creationOptions] 418 else: 419 for opt in creationOptions: 420 new_options += ['-co', opt] 421 if srcWin is not None: 422 new_options += ['-srcwin', _strHighPrec(srcWin[0]), _strHighPrec(srcWin[1]), _strHighPrec(srcWin[2]), _strHighPrec(srcWin[3])] 423 if strict: 424 new_options += ['-strict'] 425 if unscale: 426 new_options += ['-unscale'] 427 if scaleParams: 428 for scaleParam in scaleParams: 429 new_options += ['-scale'] 430 for v in scaleParam: 431 new_options += [str(v)] 432 if exponents: 433 for exponent in exponents: 434 new_options += ['-exponent', _strHighPrec(exponent)] 435 if outputBounds is not None: 436 new_options += ['-a_ullr', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 437 if metadataOptions is not None: 438 if isinstance(metadataOptions, str): 439 new_options += ['-mo', metadataOptions] 440 else: 441 for opt in metadataOptions: 442 new_options += ['-mo', opt] 443 if outputSRS is not None: 444 new_options += ['-a_srs', str(outputSRS)] 445 if nogcp: 446 new_options += ['-nogcp'] 447 if GCPs is not None: 448 for gcp in GCPs: 449 new_options += ['-gcp', _strHighPrec(gcp.GCPPixel), _strHighPrec(gcp.GCPLine), _strHighPrec(gcp.GCPX), str(gcp.GCPY), _strHighPrec(gcp.GCPZ)] 450 if projWin is not None: 451 new_options += ['-projwin', _strHighPrec(projWin[0]), _strHighPrec(projWin[1]), _strHighPrec(projWin[2]), _strHighPrec(projWin[3])] 452 if projWinSRS is not None: 453 new_options += ['-projwin_srs', str(projWinSRS)] 454 if noData is not None: 455 new_options += ['-a_nodata', _strHighPrec(noData)] 456 if rgbExpand is not None: 457 new_options += ['-expand', str(rgbExpand)] 458 if stats: 459 new_options += ['-stats'] 460 if not rat: 461 new_options += ['-norat'] 462 if not xmp: 463 new_options += ['-noxmp'] 464 if resampleAlg is not None: 465 if resampleAlg in mapGRIORAMethodToString: 466 new_options += ['-r', mapGRIORAMethodToString[resampleAlg]] 467 else: 468 new_options += ['-r', str(resampleAlg)] 469 if xRes != 0 and yRes != 0: 470 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 471 472 if return_option_list: 473 return new_options 474 475 return (GDALTranslateOptions(new_options), callback, callback_data)
476
477 -def Translate(destName, srcDS, **kwargs):
478 """ Convert a dataset. 479 Arguments are : 480 destName --- Output dataset name 481 srcDS --- a Dataset object or a filename 482 Keyword arguments are : 483 options --- return of gdal.TranslateOptions(), string or array of strings 484 other keywords arguments of gdal.TranslateOptions() 485 If options is provided as a gdal.TranslateOptions() object, other keywords are ignored. """ 486 487 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 488 (opts, callback, callback_data) = TranslateOptions(**kwargs) 489 else: 490 (opts, callback, callback_data) = kwargs['options'] 491 if isinstance(srcDS, str): 492 srcDS = Open(srcDS) 493 494 return TranslateInternal(destName, srcDS, opts, callback, callback_data)
495
496 -def WarpOptions(options=None, format=None, 497 outputBounds=None, 498 outputBoundsSRS=None, 499 xRes=None, yRes=None, targetAlignedPixels = False, 500 width = 0, height = 0, 501 srcSRS=None, dstSRS=None, 502 coordinateOperation=None, 503 srcAlpha = False, dstAlpha = False, 504 warpOptions=None, errorThreshold=None, 505 warpMemoryLimit=None, creationOptions=None, outputType = gdalconst.GDT_Unknown, 506 workingType = gdalconst.GDT_Unknown, resampleAlg=None, 507 srcNodata=None, dstNodata=None, multithread = False, 508 tps = False, rpc = False, geoloc = False, polynomialOrder=None, 509 transformerOptions=None, cutlineDSName=None, 510 cutlineLayer=None, cutlineWhere=None, cutlineSQL=None, cutlineBlend=None, cropToCutline = False, 511 copyMetadata = True, metadataConflictValue=None, 512 setColorInterpretation = False, 513 overviewLevel = 'AUTO', 514 callback=None, callback_data=None):
515 """ Create a WarpOptions() object that can be passed to gdal.Warp() 516 Keyword arguments are : 517 options --- can be be an array of strings, a string or let empty and filled from other keywords. 518 format --- output format ("GTiff", etc...) 519 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS 520 outputBoundsSRS --- SRS in which output bounds are expressed, in the case they are not expressed in dstSRS 521 xRes, yRes --- output resolution in target SRS 522 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution 523 width --- width of the output raster in pixel 524 height --- height of the output raster in pixel 525 srcSRS --- source SRS 526 dstSRS --- output SRS 527 coordinateOperation -- coordinate operation as a PROJ string or WKT string 528 srcAlpha --- whether to force the last band of the input dataset to be considered as an alpha band 529 dstAlpha --- whether to force the creation of an output alpha band 530 outputType --- output type (gdalconst.GDT_Byte, etc...) 531 workingType --- working type (gdalconst.GDT_Byte, etc...) 532 warpOptions --- list of warping options 533 errorThreshold --- error threshold for approximation transformer (in pixels) 534 warpMemoryLimit --- size of working buffer in MB 535 resampleAlg --- resampling mode 536 creationOptions --- list of creation options 537 srcNodata --- source nodata value(s) 538 dstNodata --- output nodata value(s) 539 multithread --- whether to multithread computation and I/O operations 540 tps --- whether to use Thin Plate Spline GCP transformer 541 rpc --- whether to use RPC transformer 542 geoloc --- whether to use GeoLocation array transformer 543 polynomialOrder --- order of polynomial GCP interpolation 544 transformerOptions --- list of transformer options 545 cutlineDSName --- cutline dataset name 546 cutlineLayer --- cutline layer name 547 cutlineWhere --- cutline WHERE clause 548 cutlineSQL --- cutline SQL statement 549 cutlineBlend --- cutline blend distance in pixels 550 cropToCutline --- whether to use cutline extent for output bounds 551 copyMetadata --- whether to copy source metadata 552 metadataConflictValue --- metadata data conflict value 553 setColorInterpretation --- whether to force color interpretation of input bands to output bands 554 overviewLevel --- To specify which overview level of source files must be used 555 callback --- callback method 556 callback_data --- user data for callback 557 """ 558 559 # Only used for tests 560 return_option_list = options == '__RETURN_OPTION_LIST__' 561 if return_option_list: 562 options = [] 563 else: 564 options = [] if options is None else options 565 566 if isinstance(options, str): 567 new_options = ParseCommandLine(options) 568 else: 569 new_options = options 570 if format is not None: 571 new_options += ['-of', format] 572 if outputType != gdalconst.GDT_Unknown: 573 new_options += ['-ot', GetDataTypeName(outputType)] 574 if workingType != gdalconst.GDT_Unknown: 575 new_options += ['-wt', GetDataTypeName(workingType)] 576 if outputBounds is not None: 577 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 578 if outputBoundsSRS is not None: 579 new_options += ['-te_srs', str(outputBoundsSRS)] 580 if xRes is not None and yRes is not None: 581 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 582 if width != 0 or height != 0: 583 new_options += ['-ts', str(width), str(height)] 584 if srcSRS is not None: 585 new_options += ['-s_srs', str(srcSRS)] 586 if dstSRS is not None: 587 new_options += ['-t_srs', str(dstSRS)] 588 if coordinateOperation is not None: 589 new_options += ['-ct', coordinateOperation] 590 if targetAlignedPixels: 591 new_options += ['-tap'] 592 if srcAlpha: 593 new_options += ['-srcalpha'] 594 if dstAlpha: 595 new_options += ['-dstalpha'] 596 if warpOptions is not None: 597 for opt in warpOptions: 598 new_options += ['-wo', str(opt)] 599 if errorThreshold is not None: 600 new_options += ['-et', _strHighPrec(errorThreshold)] 601 if resampleAlg is not None: 602 603 mapMethodToString = { 604 gdalconst.GRA_NearestNeighbour: 'near', 605 gdalconst.GRA_Bilinear: 'bilinear', 606 gdalconst.GRA_Cubic: 'cubic', 607 gdalconst.GRA_CubicSpline: 'cubicspline', 608 gdalconst.GRA_Lanczos: 'lanczos', 609 gdalconst.GRA_Average: 'average', 610 gdalconst.GRA_RMS: 'rms', 611 gdalconst.GRA_Mode: 'mode', 612 gdalconst.GRA_Max: 'max', 613 gdalconst.GRA_Min: 'min', 614 gdalconst.GRA_Med: 'med', 615 gdalconst.GRA_Q1: 'q1', 616 gdalconst.GRA_Q3: 'q3', 617 gdalconst.GRA_Sum: 'sum', 618 } 619 620 if resampleAlg in mapMethodToString: 621 new_options += ['-r', mapMethodToString[resampleAlg]] 622 else: 623 new_options += ['-r', str(resampleAlg)] 624 if warpMemoryLimit is not None: 625 new_options += ['-wm', str(warpMemoryLimit)] 626 if creationOptions is not None: 627 for opt in creationOptions: 628 new_options += ['-co', opt] 629 if srcNodata is not None: 630 new_options += ['-srcnodata', str(srcNodata)] 631 if dstNodata is not None: 632 new_options += ['-dstnodata', str(dstNodata)] 633 if multithread: 634 new_options += ['-multi'] 635 if tps: 636 new_options += ['-tps'] 637 if rpc: 638 new_options += ['-rpc'] 639 if geoloc: 640 new_options += ['-geoloc'] 641 if polynomialOrder is not None: 642 new_options += ['-order', str(polynomialOrder)] 643 if transformerOptions is not None: 644 for opt in transformerOptions: 645 new_options += ['-to', opt] 646 if cutlineDSName is not None: 647 new_options += ['-cutline', str(cutlineDSName)] 648 if cutlineLayer is not None: 649 new_options += ['-cl', str(cutlineLayer)] 650 if cutlineWhere is not None: 651 new_options += ['-cwhere', str(cutlineWhere)] 652 if cutlineSQL is not None: 653 new_options += ['-csql', str(cutlineSQL)] 654 if cutlineBlend is not None: 655 new_options += ['-cblend', str(cutlineBlend)] 656 if cropToCutline: 657 new_options += ['-crop_to_cutline'] 658 if not copyMetadata: 659 new_options += ['-nomd'] 660 if metadataConflictValue: 661 new_options += ['-cvmd', str(metadataConflictValue)] 662 if setColorInterpretation: 663 new_options += ['-setci'] 664 665 if overviewLevel is None or isinstance(overviewLevel, str): 666 pass 667 elif isinstance(overviewLevel, int): 668 if overviewLevel < 0: 669 overviewLevel = 'AUTO' + str(overviewLevel) 670 else: 671 overviewLevel = str(overviewLevel) 672 else: 673 overviewLevel = None 674 675 if overviewLevel is not None and overviewLevel != 'AUTO': 676 new_options += ['-ovr', overviewLevel] 677 678 if return_option_list: 679 return new_options 680 681 return (GDALWarpAppOptions(new_options), callback, callback_data)
682
683 -def Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs):
684 """ Warp one or several datasets. 685 Arguments are : 686 destNameOrDestDS --- Output dataset name or object 687 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename 688 Keyword arguments are : 689 options --- return of gdal.WarpOptions(), string or array of strings 690 other keywords arguments of gdal.WarpOptions() 691 If options is provided as a gdal.WarpOptions() object, other keywords are ignored. """ 692 693 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 694 (opts, callback, callback_data) = WarpOptions(**kwargs) 695 else: 696 (opts, callback, callback_data) = kwargs['options'] 697 if isinstance(srcDSOrSrcDSTab, str): 698 srcDSTab = [Open(srcDSOrSrcDSTab)] 699 elif isinstance(srcDSOrSrcDSTab, list): 700 srcDSTab = [] 701 for elt in srcDSOrSrcDSTab: 702 if isinstance(elt, str): 703 srcDSTab.append(Open(elt)) 704 else: 705 srcDSTab.append(elt) 706 else: 707 srcDSTab = [srcDSOrSrcDSTab] 708 709 if isinstance(destNameOrDestDS, str): 710 return wrapper_GDALWarpDestName(destNameOrDestDS, srcDSTab, opts, callback, callback_data) 711 else: 712 return wrapper_GDALWarpDestDS(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
713 714
715 -def VectorTranslateOptions(options=None, format=None, 716 accessMode=None, 717 srcSRS=None, dstSRS=None, reproject=True, 718 coordinateOperation=None, 719 SQLStatement=None, SQLDialect=None, where=None, selectFields=None, 720 addFields=False, 721 forceNullable=False, 722 emptyStrAsNull=False, 723 spatFilter=None, spatSRS=None, 724 datasetCreationOptions=None, 725 layerCreationOptions=None, 726 layers=None, 727 layerName=None, 728 geometryType=None, 729 dim=None, 730 segmentizeMaxDist= None, 731 makeValid=False, 732 zField=None, 733 resolveDomains=False, 734 skipFailures=False, 735 limit=None, 736 callback=None, callback_data=None):
737 """ Create a VectorTranslateOptions() object that can be passed to gdal.VectorTranslate() 738 Keyword arguments are : 739 options --- can be be an array of strings, a string or let empty and filled from other keywords. 740 format --- output format ("ESRI Shapefile", etc...) 741 accessMode --- None for creation, 'update', 'append', 'overwrite' 742 srcSRS --- source SRS 743 dstSRS --- output SRS (with reprojection if reproject = True) 744 coordinateOperation -- coordinate operation as a PROJ string or WKT string 745 reproject --- whether to do reprojection 746 SQLStatement --- SQL statement to apply to the source dataset 747 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...) 748 where --- WHERE clause to apply to source layer(s) 749 selectFields --- list of fields to select 750 addFields --- whether to add new fields found in source layers (to be used with accessMode == 'append') 751 forceNullable --- whether to drop NOT NULL constraints on newly created fields 752 emptyStrAsNull --- whether to treat empty string values as NULL 753 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box 754 spatSRS --- SRS in which the spatFilter is expressed. If not specified, it is assumed to be the one of the layer(s) 755 datasetCreationOptions --- list of dataset creation options 756 layerCreationOptions --- list of layer creation options 757 layers --- list of layers to convert 758 layerName --- output layer name 759 geometryType --- output layer geometry type ('POINT', ....) 760 dim --- output dimension ('XY', 'XYZ', 'XYM', 'XYZM', 'layer_dim') 761 segmentizeMaxDist --- maximum distance between consecutive nodes of a line geometry 762 makeValid --- run MakeValid() on geometries 763 zField --- name of field to use to set the Z component of geometries 764 resolveDomains --- whether to create an additional field for each field associated with a coded field domain. 765 skipFailures --- whether to skip failures 766 limit -- maximum number of features to read per layer 767 callback --- callback method 768 callback_data --- user data for callback 769 """ 770 options = [] if options is None else options 771 772 if isinstance(options, str): 773 new_options = ParseCommandLine(options) 774 else: 775 new_options = options 776 if format is not None: 777 new_options += ['-f', format] 778 if srcSRS is not None: 779 new_options += ['-s_srs', str(srcSRS)] 780 if dstSRS is not None: 781 if reproject: 782 new_options += ['-t_srs', str(dstSRS)] 783 else: 784 new_options += ['-a_srs', str(dstSRS)] 785 if coordinateOperation is not None: 786 new_options += ['-ct', coordinateOperation] 787 if SQLStatement is not None: 788 new_options += ['-sql', str(SQLStatement)] 789 if SQLDialect is not None: 790 new_options += ['-dialect', str(SQLDialect)] 791 if where is not None: 792 new_options += ['-where', str(where)] 793 if accessMode is not None: 794 if accessMode == 'update': 795 new_options += ['-update'] 796 elif accessMode == 'append': 797 new_options += ['-append'] 798 elif accessMode == 'overwrite': 799 new_options += ['-overwrite'] 800 else: 801 raise Exception('unhandled accessMode') 802 if addFields: 803 new_options += ['-addfields'] 804 if forceNullable: 805 new_options += ['-forceNullable'] 806 if emptyStrAsNull: 807 new_options += ['-emptyStrAsNull'] 808 if selectFields is not None: 809 val = '' 810 for item in selectFields: 811 if val: 812 val += ',' 813 val += item 814 new_options += ['-select', val] 815 if datasetCreationOptions is not None: 816 for opt in datasetCreationOptions: 817 new_options += ['-dsco', opt] 818 if layerCreationOptions is not None: 819 for opt in layerCreationOptions: 820 new_options += ['-lco', opt] 821 if layers is not None: 822 if isinstance(layers, str): 823 new_options += [layers] 824 else: 825 for lyr in layers: 826 new_options += [lyr] 827 if segmentizeMaxDist is not None: 828 new_options += ['-segmentize', str(segmentizeMaxDist)] 829 if makeValid: 830 new_options += ['-makevalid'] 831 if spatFilter is not None: 832 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3])] 833 if spatSRS is not None: 834 new_options += ['-spat_srs', str(spatSRS)] 835 if layerName is not None: 836 new_options += ['-nln', layerName] 837 if geometryType is not None: 838 if isinstance(geometryType, str): 839 new_options += ['-nlt', geometryType] 840 else: 841 for opt in geometryType: 842 new_options += ['-nlt', opt] 843 if dim is not None: 844 new_options += ['-dim', dim] 845 if zField is not None: 846 new_options += ['-zfield', zField] 847 if resolveDomains: 848 new_options += ['-resolveDomains'] 849 if skipFailures: 850 new_options += ['-skip'] 851 if limit is not None: 852 new_options += ['-limit', str(limit)] 853 if callback is not None: 854 new_options += ['-progress'] 855 856 return (GDALVectorTranslateOptions(new_options), callback, callback_data)
857
858 -def VectorTranslate(destNameOrDestDS, srcDS, **kwargs):
859 """ Convert one vector dataset 860 Arguments are : 861 destNameOrDestDS --- Output dataset name or object 862 srcDS --- a Dataset object or a filename 863 Keyword arguments are : 864 options --- return of gdal.VectorTranslateOptions(), string or array of strings 865 other keywords arguments of gdal.VectorTranslateOptions() 866 If options is provided as a gdal.VectorTranslateOptions() object, other keywords are ignored. """ 867 868 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 869 (opts, callback, callback_data) = VectorTranslateOptions(**kwargs) 870 else: 871 (opts, callback, callback_data) = kwargs['options'] 872 if isinstance(srcDS, str): 873 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR) 874 875 if isinstance(destNameOrDestDS, str): 876 return wrapper_GDALVectorTranslateDestName(destNameOrDestDS, srcDS, opts, callback, callback_data) 877 else: 878 return wrapper_GDALVectorTranslateDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
879
880 -def DEMProcessingOptions(options=None, colorFilename=None, format=None, 881 creationOptions=None, computeEdges=False, alg=None, band=1, 882 zFactor=None, scale=None, azimuth=None, altitude=None, 883 combined=False, multiDirectional=False, igor=False, 884 slopeFormat=None, trigonometric=False, zeroForFlat=False, 885 addAlpha=None, colorSelection=None, 886 callback=None, callback_data=None):
887 """ Create a DEMProcessingOptions() object that can be passed to gdal.DEMProcessing() 888 Keyword arguments are : 889 options --- can be be an array of strings, a string or let empty and filled from other keywords. 890 colorFilename --- (mandatory for "color-relief") name of file that contains palette definition for the "color-relief" processing. 891 format --- output format ("GTiff", etc...) 892 creationOptions --- list of creation options 893 computeEdges --- whether to compute values at raster edges. 894 alg --- 'Horn' (default) or 'ZevenbergenThorne' for hillshade, slope or aspect. 'Wilson' (default) or 'Riley' for TRI 895 band --- source band number to use 896 zFactor --- (hillshade only) vertical exaggeration used to pre-multiply the elevations. 897 scale --- ratio of vertical units to horizontal. 898 azimuth --- (hillshade only) azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps. 899 altitude ---(hillshade only) altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light. 900 combined --- (hillshade only) whether to compute combined shading, a combination of slope and oblique shading. Only one of combined, multiDirectional and igor can be specified. 901 multiDirectional --- (hillshade only) whether to compute multi-directional shading. Only one of combined, multiDirectional and igor can be specified. 902 igor --- (hillshade only) whether to use Igor's hillshading from Maperitive. Only one of combined, multiDirectional and igor can be specified. 903 slopeformat --- (slope only) "degree" or "percent". 904 trigonometric --- (aspect only) whether to return trigonometric angle instead of azimuth. Thus 0deg means East, 90deg North, 180deg West, 270deg South. 905 zeroForFlat --- (aspect only) whether to return 0 for flat areas with slope=0, instead of -9999. 906 addAlpha --- adds an alpha band to the output file (only for processing = 'color-relief') 907 colorSelection --- (color-relief only) Determines how color entries are selected from an input value. Can be "nearest_color_entry", "exact_color_entry" or "linear_interpolation". Defaults to "linear_interpolation" 908 callback --- callback method 909 callback_data --- user data for callback 910 """ 911 options = [] if options is None else options 912 913 if isinstance(options, str): 914 new_options = ParseCommandLine(options) 915 else: 916 new_options = options 917 if format is not None: 918 new_options += ['-of', format] 919 if creationOptions is not None: 920 for opt in creationOptions: 921 new_options += ['-co', opt] 922 if computeEdges: 923 new_options += ['-compute_edges'] 924 if alg: 925 new_options += ['-alg', alg] 926 new_options += ['-b', str(band)] 927 if zFactor is not None: 928 new_options += ['-z', str(zFactor)] 929 if scale is not None: 930 new_options += ['-s', str(scale)] 931 if azimuth is not None: 932 new_options += ['-az', str(azimuth)] 933 if altitude is not None: 934 new_options += ['-alt', str(altitude)] 935 if combined: 936 new_options += ['-combined'] 937 if multiDirectional: 938 new_options += ['-multidirectional'] 939 if igor: 940 new_options += ['-igor'] 941 if slopeFormat == 'percent': 942 new_options += ['-p'] 943 if trigonometric: 944 new_options += ['-trigonometric'] 945 if zeroForFlat: 946 new_options += ['-zero_for_flat'] 947 if colorSelection is not None: 948 if colorSelection == 'nearest_color_entry': 949 new_options += ['-nearest_color_entry'] 950 elif colorSelection == 'exact_color_entry': 951 new_options += ['-exact_color_entry'] 952 elif colorSelection == 'linear_interpolation': 953 pass 954 else: 955 raise ValueError("Unsupported value for colorSelection") 956 if addAlpha: 957 new_options += ['-alpha'] 958 959 return (GDALDEMProcessingOptions(new_options), colorFilename, callback, callback_data)
960
961 -def DEMProcessing(destName, srcDS, processing, **kwargs):
962 """ Apply a DEM processing. 963 Arguments are : 964 destName --- Output dataset name 965 srcDS --- a Dataset object or a filename 966 processing --- one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness" 967 Keyword arguments are : 968 options --- return of gdal.DEMProcessingOptions(), string or array of strings 969 other keywords arguments of gdal.DEMProcessingOptions() 970 If options is provided as a gdal.DEMProcessingOptions() object, other keywords are ignored. """ 971 972 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 973 (opts, colorFilename, callback, callback_data) = DEMProcessingOptions(**kwargs) 974 else: 975 (opts, colorFilename, callback, callback_data) = kwargs['options'] 976 if isinstance(srcDS, str): 977 srcDS = Open(srcDS) 978 979 return DEMProcessingInternal(destName, srcDS, processing, colorFilename, opts, callback, callback_data)
980 981
982 -def NearblackOptions(options=None, format=None, 983 creationOptions=None, white = False, colors=None, 984 maxNonBlack=None, nearDist=None, setAlpha = False, setMask = False, 985 callback=None, callback_data=None):
986 """ Create a NearblackOptions() object that can be passed to gdal.Nearblack() 987 Keyword arguments are : 988 options --- can be be an array of strings, a string or let empty and filled from other keywords. 989 format --- output format ("GTiff", etc...) 990 creationOptions --- list of creation options 991 white --- whether to search for nearly white (255) pixels instead of nearly black pixels. 992 colors --- list of colors to search for, e.g. ((0,0,0),(255,255,255)). The pixels that are considered as the collar are set to 0 993 maxNonBlack --- number of non-black (or other searched colors specified with white / colors) pixels that can be encountered before the giving up search inwards. Defaults to 2. 994 nearDist --- select how far from black, white or custom colors the pixel values can be and still considered near black, white or custom color. Defaults to 15. 995 setAlpha --- adds an alpha band to the output file. 996 setMask --- adds a mask band to the output file. 997 callback --- callback method 998 callback_data --- user data for callback 999 """ 1000 options = [] if options is None else options 1001 1002 if isinstance(options, str): 1003 new_options = ParseCommandLine(options) 1004 else: 1005 new_options = options 1006 if format is not None: 1007 new_options += ['-of', format] 1008 if creationOptions is not None: 1009 for opt in creationOptions: 1010 new_options += ['-co', opt] 1011 if white: 1012 new_options += ['-white'] 1013 if colors is not None: 1014 for color in colors: 1015 color_str = '' 1016 for cpt in color: 1017 if color_str != '': 1018 color_str += ',' 1019 color_str += str(cpt) 1020 new_options += ['-color', color_str] 1021 if maxNonBlack is not None: 1022 new_options += ['-nb', str(maxNonBlack)] 1023 if nearDist is not None: 1024 new_options += ['-near', str(nearDist)] 1025 if setAlpha: 1026 new_options += ['-setalpha'] 1027 if setMask: 1028 new_options += ['-setmask'] 1029 1030 return (GDALNearblackOptions(new_options), callback, callback_data)
1031
1032 -def Nearblack(destNameOrDestDS, srcDS, **kwargs):
1033 """ Convert nearly black/white borders to exact value. 1034 Arguments are : 1035 destNameOrDestDS --- Output dataset name or object 1036 srcDS --- a Dataset object or a filename 1037 Keyword arguments are : 1038 options --- return of gdal.NearblackOptions(), string or array of strings 1039 other keywords arguments of gdal.NearblackOptions() 1040 If options is provided as a gdal.NearblackOptions() object, other keywords are ignored. """ 1041 1042 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1043 (opts, callback, callback_data) = NearblackOptions(**kwargs) 1044 else: 1045 (opts, callback, callback_data) = kwargs['options'] 1046 if isinstance(srcDS, str): 1047 srcDS = OpenEx(srcDS) 1048 1049 if isinstance(destNameOrDestDS, str): 1050 return wrapper_GDALNearblackDestName(destNameOrDestDS, srcDS, opts, callback, callback_data) 1051 else: 1052 return wrapper_GDALNearblackDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1053 1054
1055 -def GridOptions(options=None, format=None, 1056 outputType=gdalconst.GDT_Unknown, 1057 width=0, height=0, 1058 creationOptions=None, 1059 outputBounds=None, 1060 outputSRS=None, 1061 noData=None, 1062 algorithm=None, 1063 layers=None, 1064 SQLStatement=None, 1065 where=None, 1066 spatFilter=None, 1067 zfield=None, 1068 z_increase=None, 1069 z_multiply=None, 1070 callback=None, callback_data=None):
1071 """ Create a GridOptions() object that can be passed to gdal.Grid() 1072 Keyword arguments are : 1073 options --- can be be an array of strings, a string or let empty and filled from other keywords. 1074 format --- output format ("GTiff", etc...) 1075 outputType --- output type (gdalconst.GDT_Byte, etc...) 1076 width --- width of the output raster in pixel 1077 height --- height of the output raster in pixel 1078 creationOptions --- list of creation options 1079 outputBounds --- assigned output bounds: [ulx, uly, lrx, lry] 1080 outputSRS --- assigned output SRS 1081 noData --- nodata value 1082 algorithm --- e.g "invdist:power=2.0:smoothing=0.0:radius1=0.0:radius2=0.0:angle=0.0:max_points=0:min_points=0:nodata=0.0" 1083 layers --- list of layers to convert 1084 SQLStatement --- SQL statement to apply to the source dataset 1085 where --- WHERE clause to apply to source layer(s) 1086 spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box 1087 zfield --- Identifies an attribute field on the features to be used to get a Z value from. This value overrides Z value read from feature geometry record. 1088 z_increase --- Addition to the attribute field on the features to be used to get a Z value from. The addition should be the same unit as Z value. The result value will be Z value + Z increase value. The default value is 0. 1089 z_multiply - Multiplication ratio for Z field. This can be used for shift from e.g. foot to meters or from elevation to deep. The result value will be (Z value + Z increase value) * Z multiply value. The default value is 1. 1090 callback --- callback method 1091 callback_data --- user data for callback 1092 """ 1093 options = [] if options is None else options 1094 1095 if isinstance(options, str): 1096 new_options = ParseCommandLine(options) 1097 else: 1098 new_options = options 1099 if format is not None: 1100 new_options += ['-of', format] 1101 if outputType != gdalconst.GDT_Unknown: 1102 new_options += ['-ot', GetDataTypeName(outputType)] 1103 if width != 0 or height != 0: 1104 new_options += ['-outsize', str(width), str(height)] 1105 if creationOptions is not None: 1106 for opt in creationOptions: 1107 new_options += ['-co', opt] 1108 if outputBounds is not None: 1109 new_options += ['-txe', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[2]), '-tye', _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[3])] 1110 if outputSRS is not None: 1111 new_options += ['-a_srs', str(outputSRS)] 1112 if algorithm is not None: 1113 new_options += ['-a', algorithm] 1114 if layers is not None: 1115 if isinstance(layers, (tuple, list)): 1116 for layer in layers: 1117 new_options += ['-l', layer] 1118 else: 1119 new_options += ['-l', layers] 1120 if SQLStatement is not None: 1121 new_options += ['-sql', str(SQLStatement)] 1122 if where is not None: 1123 new_options += ['-where', str(where)] 1124 if zfield is not None: 1125 new_options += ['-zfield', zfield] 1126 if z_increase is not None: 1127 new_options += ['-z_increase', str(z_increase)] 1128 if z_multiply is not None: 1129 new_options += ['-z_multiply', str(z_multiply)] 1130 if spatFilter is not None: 1131 new_options += ['-spat', str(spatFilter[0]), str(spatFilter[1]), str(spatFilter[2]), str(spatFilter[3])] 1132 1133 return (GDALGridOptions(new_options), callback, callback_data)
1134
1135 -def Grid(destName, srcDS, **kwargs):
1136 """ Create raster from the scattered data. 1137 Arguments are : 1138 destName --- Output dataset name 1139 srcDS --- a Dataset object or a filename 1140 Keyword arguments are : 1141 options --- return of gdal.GridOptions(), string or array of strings 1142 other keywords arguments of gdal.GridOptions() 1143 If options is provided as a gdal.GridOptions() object, other keywords are ignored. """ 1144 1145 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1146 (opts, callback, callback_data) = GridOptions(**kwargs) 1147 else: 1148 (opts, callback, callback_data) = kwargs['options'] 1149 if isinstance(srcDS, str): 1150 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR) 1151 1152 return GridInternal(destName, srcDS, opts, callback, callback_data)
1153
1154 -def RasterizeOptions(options=None, format=None, 1155 outputType=gdalconst.GDT_Unknown, 1156 creationOptions=None, noData=None, initValues=None, 1157 outputBounds=None, outputSRS=None, 1158 transformerOptions=None, 1159 width=None, height=None, 1160 xRes=None, yRes=None, targetAlignedPixels=False, 1161 bands=None, inverse=False, allTouched=False, 1162 burnValues=None, attribute=None, useZ=False, layers=None, 1163 SQLStatement=None, SQLDialect=None, where=None, optim=None, 1164 add=None, 1165 callback=None, callback_data=None):
1166 """ Create a RasterizeOptions() object that can be passed to gdal.Rasterize() 1167 Keyword arguments are : 1168 options --- can be be an array of strings, a string or let empty and filled from other keywords. 1169 format --- output format ("GTiff", etc...) 1170 outputType --- output type (gdalconst.GDT_Byte, etc...) 1171 creationOptions --- list of creation options 1172 outputBounds --- assigned output bounds: [minx, miny, maxx, maxy] 1173 outputSRS --- assigned output SRS 1174 transformerOptions --- list of transformer options 1175 width --- width of the output raster in pixel 1176 height --- height of the output raster in pixel 1177 xRes, yRes --- output resolution in target SRS 1178 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution 1179 noData --- nodata value 1180 initValues --- Value or list of values to pre-initialize the output image bands with. However, it is not marked as the nodata value in the output file. If only one value is given, the same value is used in all the bands. 1181 bands --- list of output bands to burn values into 1182 inverse --- whether to invert rasterization, i.e. burn the fixed burn value, or the burn value associated with the first feature into all parts of the image not inside the provided a polygon. 1183 allTouched -- whether to enable the ALL_TOUCHED rasterization option so that all pixels touched by lines or polygons will be updated, not just those on the line render path, or whose center point is within the polygon. 1184 burnValues -- list of fixed values to burn into each band for all objects. Excusive with attribute. 1185 attribute --- identifies an attribute field on the features to be used for a burn-in value. The value will be burned into all output bands. Excusive with burnValues. 1186 useZ --- whether to indicate that a burn value should be extracted from the "Z" values of the feature. These values are added to the burn value given by burnValues or attribute if provided. As of now, only points and lines are drawn in 3D. 1187 layers --- list of layers from the datasource that will be used for input features. 1188 SQLStatement --- SQL statement to apply to the source dataset 1189 SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...) 1190 where --- WHERE clause to apply to source layer(s) 1191 optim --- optimization mode ('RASTER', 'VECTOR') 1192 add --- set to True to use additive mode instead of replace when burning values 1193 callback --- callback method 1194 callback_data --- user data for callback 1195 """ 1196 options = [] if options is None else options 1197 1198 if isinstance(options, str): 1199 new_options = ParseCommandLine(options) 1200 else: 1201 new_options = options 1202 if format is not None: 1203 new_options += ['-of', format] 1204 if outputType != gdalconst.GDT_Unknown: 1205 new_options += ['-ot', GetDataTypeName(outputType)] 1206 if creationOptions is not None: 1207 for opt in creationOptions: 1208 new_options += ['-co', opt] 1209 if bands is not None: 1210 for b in bands: 1211 new_options += ['-b', str(b)] 1212 if noData is not None: 1213 new_options += ['-a_nodata', str(noData)] 1214 if initValues is not None: 1215 if isinstance(initValues, (tuple, list)): 1216 for val in initValues: 1217 new_options += ['-init', str(val)] 1218 else: 1219 new_options += ['-init', str(initValues)] 1220 if outputBounds is not None: 1221 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 1222 if outputSRS is not None: 1223 new_options += ['-a_srs', str(outputSRS)] 1224 if transformerOptions is not None: 1225 for opt in transformerOptions: 1226 new_options += ['-to', opt] 1227 if width is not None and height is not None: 1228 new_options += ['-ts', str(width), str(height)] 1229 if xRes is not None and yRes is not None: 1230 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 1231 if targetAlignedPixels: 1232 new_options += ['-tap'] 1233 if inverse: 1234 new_options += ['-i'] 1235 if allTouched: 1236 new_options += ['-at'] 1237 if burnValues is not None: 1238 if attribute is not None: 1239 raise Exception('burnValues and attribute option are exclusive.') 1240 if isinstance(burnValues, (tuple, list)): 1241 for val in burnValues: 1242 new_options += ['-burn', str(val)] 1243 else: 1244 new_options += ['-burn', str(burnValues)] 1245 if attribute is not None: 1246 new_options += ['-a', attribute] 1247 if useZ: 1248 new_options += ['-3d'] 1249 if layers is not None: 1250 if isinstance(layers, ((tuple, list))): 1251 for layer in layers: 1252 new_options += ['-l', layer] 1253 else: 1254 new_options += ['-l', layers] 1255 if SQLStatement is not None: 1256 new_options += ['-sql', str(SQLStatement)] 1257 if SQLDialect is not None: 1258 new_options += ['-dialect', str(SQLDialect)] 1259 if where is not None: 1260 new_options += ['-where', str(where)] 1261 if optim is not None: 1262 new_options += ['-optim', str(optim)] 1263 if add: 1264 new_options += ['-add'] 1265 1266 return (GDALRasterizeOptions(new_options), callback, callback_data)
1267
1268 -def Rasterize(destNameOrDestDS, srcDS, **kwargs):
1269 """ Burns vector geometries into a raster 1270 Arguments are : 1271 destNameOrDestDS --- Output dataset name or object 1272 srcDS --- a Dataset object or a filename 1273 Keyword arguments are : 1274 options --- return of gdal.RasterizeOptions(), string or array of strings 1275 other keywords arguments of gdal.RasterizeOptions() 1276 If options is provided as a gdal.RasterizeOptions() object, other keywords are ignored. """ 1277 1278 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1279 (opts, callback, callback_data) = RasterizeOptions(**kwargs) 1280 else: 1281 (opts, callback, callback_data) = kwargs['options'] 1282 if isinstance(srcDS, str): 1283 srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR) 1284 1285 if isinstance(destNameOrDestDS, str): 1286 return wrapper_GDALRasterizeDestName(destNameOrDestDS, srcDS, opts, callback, callback_data) 1287 else: 1288 return wrapper_GDALRasterizeDestDS(destNameOrDestDS, srcDS, opts, callback, callback_data)
1289 1290
1291 -def BuildVRTOptions(options=None, 1292 resolution=None, 1293 outputBounds=None, 1294 xRes=None, yRes=None, 1295 targetAlignedPixels=None, 1296 separate=None, 1297 bandList=None, 1298 addAlpha=None, 1299 resampleAlg=None, 1300 outputSRS=None, 1301 allowProjectionDifference=None, 1302 srcNodata=None, 1303 VRTNodata=None, 1304 hideNodata=None, 1305 strict=False, 1306 callback=None, callback_data=None):
1307 """ Create a BuildVRTOptions() object that can be passed to gdal.BuildVRT() 1308 Keyword arguments are : 1309 options --- can be be an array of strings, a string or let empty and filled from other keywords.. 1310 resolution --- 'highest', 'lowest', 'average', 'user'. 1311 outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS. 1312 xRes, yRes --- output resolution in target SRS. 1313 targetAlignedPixels --- whether to force output bounds to be multiple of output resolution. 1314 separate --- whether each source file goes into a separate stacked band in the VRT band. 1315 bandList --- array of band numbers (index start at 1). 1316 addAlpha --- whether to add an alpha mask band to the VRT when the source raster have none. 1317 resampleAlg --- resampling mode. 1318 outputSRS --- assigned output SRS. 1319 allowProjectionDifference --- whether to accept input datasets have not the same projection. Note: they will *not* be reprojected. 1320 srcNodata --- source nodata value(s). 1321 VRTNodata --- nodata values at the VRT band level. 1322 hideNodata --- whether to make the VRT band not report the NoData value. 1323 strict --- set to True if warnings should be failures 1324 callback --- callback method. 1325 callback_data --- user data for callback. 1326 """ 1327 1328 # Only used for tests 1329 return_option_list = options == '__RETURN_OPTION_LIST__' 1330 if return_option_list: 1331 options = [] 1332 else: 1333 options = [] if options is None else options 1334 1335 if isinstance(options, str): 1336 new_options = ParseCommandLine(options) 1337 else: 1338 new_options = options 1339 if resolution is not None: 1340 new_options += ['-resolution', str(resolution)] 1341 if outputBounds is not None: 1342 new_options += ['-te', _strHighPrec(outputBounds[0]), _strHighPrec(outputBounds[1]), _strHighPrec(outputBounds[2]), _strHighPrec(outputBounds[3])] 1343 if xRes is not None and yRes is not None: 1344 new_options += ['-tr', _strHighPrec(xRes), _strHighPrec(yRes)] 1345 if targetAlignedPixels: 1346 new_options += ['-tap'] 1347 if separate: 1348 new_options += ['-separate'] 1349 if bandList != None: 1350 for b in bandList: 1351 new_options += ['-b', str(b)] 1352 if addAlpha: 1353 new_options += ['-addalpha'] 1354 if resampleAlg is not None: 1355 if resampleAlg in mapGRIORAMethodToString: 1356 new_options += ['-r', mapGRIORAMethodToString[resampleAlg]] 1357 else: 1358 new_options += ['-r', str(resampleAlg)] 1359 if outputSRS is not None: 1360 new_options += ['-a_srs', str(outputSRS)] 1361 if allowProjectionDifference: 1362 new_options += ['-allow_projection_difference'] 1363 if srcNodata is not None: 1364 new_options += ['-srcnodata', str(srcNodata)] 1365 if VRTNodata is not None: 1366 new_options += ['-vrtnodata', str(VRTNodata)] 1367 if hideNodata: 1368 new_options += ['-hidenodata'] 1369 if strict: 1370 new_options += ['-strict'] 1371 1372 if return_option_list: 1373 return new_options 1374 1375 return (GDALBuildVRTOptions(new_options), callback, callback_data)
1376
1377 -def BuildVRT(destName, srcDSOrSrcDSTab, **kwargs):
1378 """ Build a VRT from a list of datasets. 1379 Arguments are : 1380 destName --- Output dataset name 1381 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename 1382 Keyword arguments are : 1383 options --- return of gdal.BuildVRTOptions(), string or array of strings 1384 other keywords arguments of gdal.BuildVRTOptions() 1385 If options is provided as a gdal.BuildVRTOptions() object, other keywords are ignored. """ 1386 1387 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1388 (opts, callback, callback_data) = BuildVRTOptions(**kwargs) 1389 else: 1390 (opts, callback, callback_data) = kwargs['options'] 1391 1392 srcDSTab = [] 1393 srcDSNamesTab = [] 1394 if isinstance(srcDSOrSrcDSTab, str): 1395 srcDSNamesTab = [srcDSOrSrcDSTab] 1396 elif isinstance(srcDSOrSrcDSTab, list): 1397 for elt in srcDSOrSrcDSTab: 1398 if isinstance(elt, str): 1399 srcDSNamesTab.append(elt) 1400 else: 1401 srcDSTab.append(elt) 1402 if srcDSTab and srcDSNamesTab: 1403 raise Exception('Mix of names and dataset objects not supported') 1404 else: 1405 srcDSTab = [srcDSOrSrcDSTab] 1406 1407 if srcDSTab: 1408 return BuildVRTInternalObjects(destName, srcDSTab, opts, callback, callback_data) 1409 else: 1410 return BuildVRTInternalNames(destName, srcDSNamesTab, opts, callback, callback_data)
1411 1412
1413 -def MultiDimTranslateOptions(options=None, format=None, creationOptions=None, 1414 arraySpecs=None, groupSpecs=None, subsetSpecs=None, scaleAxesSpecs=None, 1415 callback=None, callback_data=None):
1416 """ Create a MultiDimTranslateOptions() object that can be passed to gdal.MultiDimTranslate() 1417 Keyword arguments are : 1418 options --- can be be an array of strings, a string or let empty and filled from other keywords. 1419 format --- output format ("GTiff", etc...) 1420 creationOptions --- list of creation options 1421 arraySpecs -- list of array specifications, each of them being an array name or "name={src_array_name},dstname={dst_name},transpose=[1,0],view=[:,::-1]" 1422 groupSpecs -- list of group specifications, each of them being a group name or "name={src_array_name},dstname={dst_name},recursive=no" 1423 subsetSpecs -- list of subset specifications, each of them being like "{dim_name}({min_val},{max_val})" or "{dim_name}({slice_va})" 1424 scaleAxesSpecs -- list of dimension scaling specifications, each of them being like "{dim_name}({scale_factor})" 1425 callback --- callback method 1426 callback_data --- user data for callback 1427 """ 1428 options = [] if options is None else options 1429 1430 if isinstance(options, str): 1431 new_options = ParseCommandLine(options) 1432 else: 1433 new_options = options 1434 if format is not None: 1435 new_options += ['-of', format] 1436 if creationOptions is not None: 1437 for opt in creationOptions: 1438 new_options += ['-co', opt] 1439 if arraySpecs is not None: 1440 for s in arraySpecs: 1441 new_options += ['-array', s] 1442 if groupSpecs is not None: 1443 for s in groupSpecs: 1444 new_options += ['-group', s] 1445 if subsetSpecs is not None: 1446 for s in subsetSpecs: 1447 new_options += ['-subset', s] 1448 if scaleAxesSpecs is not None: 1449 for s in scaleAxesSpecs: 1450 new_options += ['-scaleaxes', s] 1451 1452 return (GDALMultiDimTranslateOptions(new_options), callback, callback_data)
1453
1454 -def MultiDimTranslate(destName, srcDSOrSrcDSTab, **kwargs):
1455 """ MultiDimTranslate one or several datasets. 1456 Arguments are : 1457 destName --- Output dataset name 1458 srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename 1459 Keyword arguments are : 1460 options --- return of gdal.MultiDimTranslateOptions(), string or array of strings 1461 other keywords arguments of gdal.MultiDimTranslateOptions() 1462 If options is provided as a gdal.MultiDimTranslateOptions() object, other keywords are ignored. """ 1463 1464 if 'options' not in kwargs or isinstance(kwargs['options'], (list, str)): 1465 (opts, callback, callback_data) = MultiDimTranslateOptions(**kwargs) 1466 else: 1467 (opts, callback, callback_data) = kwargs['options'] 1468 if isinstance(srcDSOrSrcDSTab, str): 1469 srcDSTab = [OpenEx(srcDSOrSrcDSTab, OF_VERBOSE_ERROR | OF_RASTER | OF_MULTIDIM_RASTER)] 1470 elif isinstance(srcDSOrSrcDSTab, list): 1471 srcDSTab = [] 1472 for elt in srcDSOrSrcDSTab: 1473 if isinstance(elt, str): 1474 srcDSTab.append(OpenEx(elt, OF_VERBOSE_ERROR | OF_RASTER | OF_MULTIDIM_RASTER)) 1475 else: 1476 srcDSTab.append(elt) 1477 else: 1478 srcDSTab = [srcDSOrSrcDSTab] 1479 1480 return wrapper_GDALMultiDimTranslateDestName(destName, srcDSTab, opts, callback, callback_data)
1481 1482 # Logging Helpers
1483 -def _pylog_handler(err_level, err_no, err_msg):
1484 if err_no != gdalconst.CPLE_None: 1485 typ = _pylog_handler.errcode_map.get(err_no, str(err_no)) 1486 message = "%s: %s" % (typ, err_msg) 1487 else: 1488 message = err_msg 1489 1490 level = _pylog_handler.level_map.get(err_level, 20) # default level is INFO 1491 _pylog_handler.logger.log(level, message)
1492
1493 -def ConfigurePythonLogging(logger_name='gdal', enable_debug=False):
1494 """ Configure GDAL to use Python's logging framework """ 1495 import logging 1496 1497 _pylog_handler.logger = logging.getLogger(logger_name) 1498 1499 # map CPLE_* constants to names 1500 _pylog_handler.errcode_map = {_num: _name[5:] for _name, _num in gdalconst.__dict__.items() if _name.startswith('CPLE_')} 1501 1502 # Map GDAL log levels to Python's 1503 _pylog_handler.level_map = { 1504 CE_None: logging.INFO, 1505 CE_Debug: logging.DEBUG, 1506 CE_Warning: logging.WARN, 1507 CE_Failure: logging.ERROR, 1508 CE_Fatal: logging.CRITICAL, 1509 } 1510 1511 # Set CPL_DEBUG so debug messages are passed through the logger 1512 if enable_debug: 1513 SetConfigOption("CPL_DEBUG", "ON") 1514 1515 # Install as the default GDAL log handler 1516 SetErrorHandler(_pylog_handler)
1517 1518
1519 -def EscapeString(*args, **kwargs):
1520 """EscapeString(string_or_bytes, scheme = gdal.CPLES_SQL)""" 1521 if isinstance(args[0], bytes): 1522 return _gdal.EscapeBinary(*args, **kwargs) 1523 else: 1524 return _gdal.wrapper_EscapeString(*args, **kwargs)
1525 1526
1527 -def ApplyVerticalShiftGrid(*args, **kwargs):
1528 """ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) -> Dataset""" 1529 1530 from warnings import warn 1531 warn('ApplyVerticalShiftGrid() will be removed in GDAL 4.0', DeprecationWarning) 1532 return _ApplyVerticalShiftGrid(*args, **kwargs)
1533 1534 1535
1536 -def Debug(*args):
1537 """Debug(char const * msg_class, char const * message)""" 1538 return _gdal.Debug(*args)
1539
1540 -def SetErrorHandler(*args):
1541 """SetErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr""" 1542 return _gdal.SetErrorHandler(*args)
1543
1544 -def SetCurrentErrorHandlerCatchDebug(*args):
1545 """SetCurrentErrorHandlerCatchDebug(int bCatchDebug)""" 1546 return _gdal.SetCurrentErrorHandlerCatchDebug(*args)
1547
1548 -def PushErrorHandler(*args):
1549 """PushErrorHandler(CPLErrorHandler pfnErrorHandler=0) -> CPLErr""" 1550 return _gdal.PushErrorHandler(*args)
1551
1552 -def PopErrorHandler(*args):
1553 """PopErrorHandler()""" 1554 return _gdal.PopErrorHandler(*args)
1555
1556 -def Error(*args):
1557 """Error(CPLErr msg_class, int err_code=0, char const * msg)""" 1558 return _gdal.Error(*args)
1559
1560 -def GOA2GetAuthorizationURL(*args):
1561 """GOA2GetAuthorizationURL(char const * pszScope) -> retStringAndCPLFree *""" 1562 return _gdal.GOA2GetAuthorizationURL(*args)
1563
1564 -def GOA2GetRefreshToken(*args):
1565 """GOA2GetRefreshToken(char const * pszAuthToken, char const * pszScope) -> retStringAndCPLFree *""" 1566 return _gdal.GOA2GetRefreshToken(*args)
1567
1568 -def GOA2GetAccessToken(*args):
1569 """GOA2GetAccessToken(char const * pszRefreshToken, char const * pszScope) -> retStringAndCPLFree *""" 1570 return _gdal.GOA2GetAccessToken(*args)
1571
1572 -def ErrorReset(*args):
1573 """ErrorReset()""" 1574 return _gdal.ErrorReset(*args)
1575
1576 -def wrapper_EscapeString(*args, **kwargs):
1577 """wrapper_EscapeString(int len, int scheme) -> retStringAndCPLFree *""" 1578 return _gdal.wrapper_EscapeString(*args, **kwargs)
1579
1580 -def EscapeBinary(*args, **kwargs):
1581 """EscapeBinary(int len, int scheme)""" 1582 return _gdal.EscapeBinary(*args, **kwargs)
1583
1584 -def GetLastErrorNo(*args):
1585 """GetLastErrorNo() -> int""" 1586 return _gdal.GetLastErrorNo(*args)
1587
1588 -def GetLastErrorType(*args):
1589 """GetLastErrorType() -> int""" 1590 return _gdal.GetLastErrorType(*args)
1591
1592 -def GetLastErrorMsg(*args):
1593 """GetLastErrorMsg() -> char const *""" 1594 return _gdal.GetLastErrorMsg(*args)
1595
1596 -def GetErrorCounter(*args):
1597 """GetErrorCounter() -> unsigned int""" 1598 return _gdal.GetErrorCounter(*args)
1599
1600 -def VSIGetLastErrorNo(*args):
1601 """VSIGetLastErrorNo() -> int""" 1602 return _gdal.VSIGetLastErrorNo(*args)
1603
1604 -def VSIGetLastErrorMsg(*args):
1605 """VSIGetLastErrorMsg() -> char const *""" 1606 return _gdal.VSIGetLastErrorMsg(*args)
1607
1608 -def VSIErrorReset(*args):
1609 """VSIErrorReset()""" 1610 return _gdal.VSIErrorReset(*args)
1611
1612 -def PushFinderLocation(*args):
1613 """PushFinderLocation(char const * utf8_path)""" 1614 return _gdal.PushFinderLocation(*args)
1615
1616 -def PopFinderLocation(*args):
1617 """PopFinderLocation()""" 1618 return _gdal.PopFinderLocation(*args)
1619
1620 -def FinderClean(*args):
1621 """FinderClean()""" 1622 return _gdal.FinderClean(*args)
1623
1624 -def FindFile(*args):
1625 """FindFile(char const * pszClass, char const * utf8_path) -> char const *""" 1626 return _gdal.FindFile(*args)
1627
1628 -def ReadDir(*args):
1629 """ReadDir(char const * utf8_path, int nMaxFiles=0) -> char **""" 1630 return _gdal.ReadDir(*args)
1631
1632 -def ReadDirRecursive(*args):
1633 """ReadDirRecursive(char const * utf8_path) -> char **""" 1634 return _gdal.ReadDirRecursive(*args)
1635
1636 -def OpenDir(*args):
1637 """OpenDir(char const * utf8_path, int nRecurseDepth=-1, char ** options=None) -> VSIDIR *""" 1638 return _gdal.OpenDir(*args)
1639 -class DirEntry(_object):
1640 """Proxy of C++ DirEntry class.""" 1641 1642 __swig_setmethods__ = {} 1643 __setattr__ = lambda self, name, value: _swig_setattr(self, DirEntry, name, value) 1644 __swig_getmethods__ = {} 1645 __getattr__ = lambda self, name: _swig_getattr(self, DirEntry, name) 1646 __repr__ = _swig_repr 1647 __swig_getmethods__["name"] = _gdal.DirEntry_name_get 1648 if _newclass: 1649 name = _swig_property(_gdal.DirEntry_name_get) 1650 __swig_getmethods__["mode"] = _gdal.DirEntry_mode_get 1651 if _newclass: 1652 mode = _swig_property(_gdal.DirEntry_mode_get) 1653 __swig_getmethods__["size"] = _gdal.DirEntry_size_get 1654 if _newclass: 1655 size = _swig_property(_gdal.DirEntry_size_get) 1656 __swig_getmethods__["mtime"] = _gdal.DirEntry_mtime_get 1657 if _newclass: 1658 mtime = _swig_property(_gdal.DirEntry_mtime_get) 1659 __swig_getmethods__["modeKnown"] = _gdal.DirEntry_modeKnown_get 1660 if _newclass: 1661 modeKnown = _swig_property(_gdal.DirEntry_modeKnown_get) 1662 __swig_getmethods__["sizeKnown"] = _gdal.DirEntry_sizeKnown_get 1663 if _newclass: 1664 sizeKnown = _swig_property(_gdal.DirEntry_sizeKnown_get) 1665 __swig_getmethods__["mtimeKnown"] = _gdal.DirEntry_mtimeKnown_get 1666 if _newclass: 1667 mtimeKnown = _swig_property(_gdal.DirEntry_mtimeKnown_get) 1668 __swig_getmethods__["extra"] = _gdal.DirEntry_extra_get 1669 if _newclass: 1670 extra = _swig_property(_gdal.DirEntry_extra_get) 1671
1672 - def __init__(self, *args):
1673 """__init__(DirEntry self, DirEntry entryIn) -> DirEntry""" 1674 this = _gdal.new_DirEntry(*args) 1675 try: 1676 self.this.append(this) 1677 except __builtin__.Exception: 1678 self.this = this
1679 __swig_destroy__ = _gdal.delete_DirEntry 1680 __del__ = lambda self: None 1681
1682 - def IsDirectory(self, *args):
1683 """IsDirectory(DirEntry self) -> bool""" 1684 return _gdal.DirEntry_IsDirectory(self, *args)
1685 1686 DirEntry_swigregister = _gdal.DirEntry_swigregister 1687 DirEntry_swigregister(DirEntry) 1688 1689
1690 -def GetNextDirEntry(*args):
1691 """GetNextDirEntry(VSIDIR * dir) -> DirEntry""" 1692 return _gdal.GetNextDirEntry(*args)
1693
1694 -def CloseDir(*args):
1695 """CloseDir(VSIDIR * dir)""" 1696 return _gdal.CloseDir(*args)
1697
1698 -def SetConfigOption(*args):
1699 """SetConfigOption(char const * pszKey, char const * pszValue)""" 1700 return _gdal.SetConfigOption(*args)
1701
1702 -def SetThreadLocalConfigOption(*args):
1703 """SetThreadLocalConfigOption(char const * pszKey, char const * pszValue)""" 1704 return _gdal.SetThreadLocalConfigOption(*args)
1705
1706 -def GetConfigOption(*args):
1707 """GetConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *""" 1708 return _gdal.GetConfigOption(*args)
1709
1710 -def GetThreadLocalConfigOption(*args):
1711 """GetThreadLocalConfigOption(char const * pszKey, char const * pszDefault=None) -> char const *""" 1712 return _gdal.GetThreadLocalConfigOption(*args)
1713
1714 -def SetCredential(*args):
1715 """SetCredential(char const * pszPathPrefix, char const * pszKey, char const * pszValue)""" 1716 return _gdal.SetCredential(*args)
1717
1718 -def GetCredential(*args):
1719 """GetCredential(char const * pszPathPrefix, char const * pszKey, char const * pszDefault=None) -> char const *""" 1720 return _gdal.GetCredential(*args)
1721
1722 -def ClearCredentials(*args):
1723 """ClearCredentials(char const * pszPathPrefix=None)""" 1724 return _gdal.ClearCredentials(*args)
1725
1726 -def CPLBinaryToHex(*args):
1727 """CPLBinaryToHex(int nBytes) -> retStringAndCPLFree *""" 1728 return _gdal.CPLBinaryToHex(*args)
1729
1730 -def CPLHexToBinary(*args):
1731 """CPLHexToBinary(char const * pszHex, int * pnBytes) -> GByte *""" 1732 return _gdal.CPLHexToBinary(*args)
1733
1734 -def FileFromMemBuffer(*args):
1735 """FileFromMemBuffer(char const * utf8_path, GIntBig nBytes)""" 1736 return _gdal.FileFromMemBuffer(*args)
1737 1741
1742 -def UnlinkBatch(*args):
1743 """UnlinkBatch(char ** files) -> bool""" 1744 return _gdal.UnlinkBatch(*args)
1745
1746 -def HasThreadSupport(*args):
1747 """HasThreadSupport() -> int""" 1748 return _gdal.HasThreadSupport(*args)
1749
1750 -def Mkdir(*args):
1751 """Mkdir(char const * utf8_path, int mode) -> VSI_RETVAL""" 1752 return _gdal.Mkdir(*args)
1753
1754 -def Rmdir(*args):
1755 """Rmdir(char const * utf8_path) -> VSI_RETVAL""" 1756 return _gdal.Rmdir(*args)
1757
1758 -def MkdirRecursive(*args):
1759 """MkdirRecursive(char const * utf8_path, int mode) -> VSI_RETVAL""" 1760 return _gdal.MkdirRecursive(*args)
1761
1762 -def RmdirRecursive(*args):
1763 """RmdirRecursive(char const * utf8_path) -> VSI_RETVAL""" 1764 return _gdal.RmdirRecursive(*args)
1765
1766 -def Rename(*args):
1767 """Rename(char const * pszOld, char const * pszNew) -> VSI_RETVAL""" 1768 return _gdal.Rename(*args)
1769
1770 -def Sync(*args, **kwargs):
1771 """Sync(char const * pszSource, char const * pszTarget, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> bool""" 1772 return _gdal.Sync(*args, **kwargs)
1773
1774 -def AbortPendingUploads(*args):
1775 """AbortPendingUploads(char const * utf8_path) -> bool""" 1776 return _gdal.AbortPendingUploads(*args)
1777
1778 -def GetActualURL(*args):
1779 """GetActualURL(char const * utf8_path) -> char const *""" 1780 return _gdal.GetActualURL(*args)
1781
1782 -def GetSignedURL(*args):
1783 """GetSignedURL(char const * utf8_path, char ** options=None) -> retStringAndCPLFree *""" 1784 return _gdal.GetSignedURL(*args)
1785
1786 -def GetFileSystemsPrefixes(*args):
1787 """GetFileSystemsPrefixes() -> char **""" 1788 return _gdal.GetFileSystemsPrefixes(*args)
1789
1790 -def GetFileSystemOptions(*args):
1791 """GetFileSystemOptions(char const * utf8_path) -> char const *""" 1792 return _gdal.GetFileSystemOptions(*args)
1793 -class VSILFILE(_object):
1794 """Proxy of C++ VSILFILE class.""" 1795 1796 __swig_setmethods__ = {} 1797 __setattr__ = lambda self, name, value: _swig_setattr(self, VSILFILE, name, value) 1798 __swig_getmethods__ = {} 1799 __getattr__ = lambda self, name: _swig_getattr(self, VSILFILE, name) 1800
1801 - def __init__(self, *args, **kwargs):
1802 raise AttributeError("No constructor defined")
1803 __repr__ = _swig_repr
1804 VSILFILE_swigregister = _gdal.VSILFILE_swigregister 1805 VSILFILE_swigregister(VSILFILE) 1806 1807 VSI_STAT_EXISTS_FLAG = _gdal.VSI_STAT_EXISTS_FLAG 1808 VSI_STAT_NATURE_FLAG = _gdal.VSI_STAT_NATURE_FLAG 1809 VSI_STAT_SIZE_FLAG = _gdal.VSI_STAT_SIZE_FLAG 1810 VSI_STAT_SET_ERROR_FLAG = _gdal.VSI_STAT_SET_ERROR_FLAG 1811 VSI_STAT_CACHE_ONLY = _gdal.VSI_STAT_CACHE_ONLY
1812 -class StatBuf(_object):
1813 """Proxy of C++ StatBuf class.""" 1814 1815 __swig_setmethods__ = {} 1816 __setattr__ = lambda self, name, value: _swig_setattr(self, StatBuf, name, value) 1817 __swig_getmethods__ = {} 1818 __getattr__ = lambda self, name: _swig_getattr(self, StatBuf, name) 1819 __repr__ = _swig_repr 1820 __swig_getmethods__["mode"] = _gdal.StatBuf_mode_get 1821 if _newclass: 1822 mode = _swig_property(_gdal.StatBuf_mode_get) 1823 __swig_getmethods__["size"] = _gdal.StatBuf_size_get 1824 if _newclass: 1825 size = _swig_property(_gdal.StatBuf_size_get) 1826 __swig_getmethods__["mtime"] = _gdal.StatBuf_mtime_get 1827 if _newclass: 1828 mtime = _swig_property(_gdal.StatBuf_mtime_get) 1829
1830 - def __init__(self, *args):
1831 """__init__(StatBuf self, StatBuf psStatBuf) -> StatBuf""" 1832 this = _gdal.new_StatBuf(*args) 1833 try: 1834 self.this.append(this) 1835 except __builtin__.Exception: 1836 self.this = this
1837 __swig_destroy__ = _gdal.delete_StatBuf 1838 __del__ = lambda self: None 1839
1840 - def IsDirectory(self, *args):
1841 """IsDirectory(StatBuf self) -> int""" 1842 return _gdal.StatBuf_IsDirectory(self, *args)
1843 1844 StatBuf_swigregister = _gdal.StatBuf_swigregister 1845 StatBuf_swigregister(StatBuf) 1846 1847
1848 -def VSIStatL(*args):
1849 """VSIStatL(char const * utf8_path, int nFlags=0) -> int""" 1850 return _gdal.VSIStatL(*args)
1851
1852 -def GetFileMetadata(*args):
1853 """GetFileMetadata(char const * utf8_path, char const * domain, char ** options=None) -> char **""" 1854 return _gdal.GetFileMetadata(*args)
1855
1856 -def SetFileMetadata(*args):
1857 """SetFileMetadata(char const * utf8_path, char ** metadata, char const * domain, char ** options=None) -> bool""" 1858 return _gdal.SetFileMetadata(*args)
1859
1860 -def VSIFOpenL(*args):
1861 """VSIFOpenL(char const * utf8_path, char const * pszMode) -> VSILFILE""" 1862 return _gdal.VSIFOpenL(*args)
1863
1864 -def VSIFOpenExL(*args):
1865 """VSIFOpenExL(char const * utf8_path, char const * pszMode, int bSetError=False, char ** options=None) -> VSILFILE""" 1866 return _gdal.VSIFOpenExL(*args)
1867
1868 -def VSIFEofL(*args):
1869 """VSIFEofL(VSILFILE fp) -> int""" 1870 return _gdal.VSIFEofL(*args)
1871
1872 -def VSIFFlushL(*args):
1873 """VSIFFlushL(VSILFILE fp) -> int""" 1874 return _gdal.VSIFFlushL(*args)
1875
1876 -def VSIFCloseL(*args):
1877 """VSIFCloseL(VSILFILE fp) -> VSI_RETVAL""" 1878 return _gdal.VSIFCloseL(*args)
1879
1880 -def VSIFSeekL(*args):
1881 """VSIFSeekL(VSILFILE fp, GIntBig offset, int whence) -> int""" 1882 return _gdal.VSIFSeekL(*args)
1883
1884 -def VSIFTellL(*args):
1885 """VSIFTellL(VSILFILE fp) -> GIntBig""" 1886 return _gdal.VSIFTellL(*args)
1887
1888 -def VSIFTruncateL(*args):
1889 """VSIFTruncateL(VSILFILE fp, GIntBig length) -> int""" 1890 return _gdal.VSIFTruncateL(*args)
1891
1892 -def VSISupportsSparseFiles(*args):
1893 """VSISupportsSparseFiles(char const * utf8_path) -> int""" 1894 return _gdal.VSISupportsSparseFiles(*args)
1895 VSI_RANGE_STATUS_UNKNOWN = _gdal.VSI_RANGE_STATUS_UNKNOWN 1896 VSI_RANGE_STATUS_DATA = _gdal.VSI_RANGE_STATUS_DATA 1897 VSI_RANGE_STATUS_HOLE = _gdal.VSI_RANGE_STATUS_HOLE 1898
1899 -def VSIFGetRangeStatusL(*args):
1900 """VSIFGetRangeStatusL(VSILFILE fp, GIntBig offset, GIntBig length) -> int""" 1901 return _gdal.VSIFGetRangeStatusL(*args)
1902
1903 -def VSIFWriteL(*args):
1904 """VSIFWriteL(int nLen, int size, int memb, VSILFILE fp) -> int""" 1905 return _gdal.VSIFWriteL(*args)
1906
1907 -def VSICurlClearCache(*args):
1908 """VSICurlClearCache()""" 1909 return _gdal.VSICurlClearCache(*args)
1910
1911 -def VSICurlPartialClearCache(*args):
1912 """VSICurlPartialClearCache(char const * utf8_path)""" 1913 return _gdal.VSICurlPartialClearCache(*args)
1914
1915 -def NetworkStatsReset(*args):
1916 """NetworkStatsReset()""" 1917 return _gdal.NetworkStatsReset(*args)
1918
1919 -def NetworkStatsGetAsSerializedJSON(*args):
1920 """NetworkStatsGetAsSerializedJSON(char ** options=None) -> retStringAndCPLFree *""" 1921 return _gdal.NetworkStatsGetAsSerializedJSON(*args)
1922
1923 -def ParseCommandLine(*args):
1924 """ParseCommandLine(char const * utf8_path) -> char **""" 1925 return _gdal.ParseCommandLine(*args)
1926 -class MajorObject(_object):
1927 """Proxy of C++ GDALMajorObjectShadow class.""" 1928 1929 __swig_setmethods__ = {} 1930 __setattr__ = lambda self, name, value: _swig_setattr(self, MajorObject, name, value) 1931 __swig_getmethods__ = {} 1932 __getattr__ = lambda self, name: _swig_getattr(self, MajorObject, name) 1933
1934 - def __init__(self, *args, **kwargs):
1935 raise AttributeError("No constructor defined")
1936 __repr__ = _swig_repr 1937
1938 - def GetDescription(self, *args):
1939 """GetDescription(MajorObject self) -> char const *""" 1940 return _gdal.MajorObject_GetDescription(self, *args)
1941 1942
1943 - def SetDescription(self, *args):
1944 """SetDescription(MajorObject self, char const * pszNewDesc)""" 1945 return _gdal.MajorObject_SetDescription(self, *args)
1946 1947
1948 - def GetMetadataDomainList(self, *args):
1949 """GetMetadataDomainList(MajorObject self) -> char **""" 1950 return _gdal.MajorObject_GetMetadataDomainList(self, *args)
1951 1952
1953 - def GetMetadata_Dict(self, *args):
1954 """GetMetadata_Dict(MajorObject self, char const * pszDomain) -> char **""" 1955 return _gdal.MajorObject_GetMetadata_Dict(self, *args)
1956 1957
1958 - def GetMetadata_List(self, *args):
1959 """GetMetadata_List(MajorObject self, char const * pszDomain) -> char **""" 1960 return _gdal.MajorObject_GetMetadata_List(self, *args)
1961 1962
1963 - def SetMetadata(self, *args):
1964 """ 1965 SetMetadata(MajorObject self, char ** papszMetadata, char const * pszDomain) -> CPLErr 1966 SetMetadata(MajorObject self, char * pszMetadataString, char const * pszDomain) -> CPLErr 1967 """ 1968 return _gdal.MajorObject_SetMetadata(self, *args)
1969 1970
1971 - def GetMetadataItem(self, *args):
1972 """GetMetadataItem(MajorObject self, char const * pszName, char const * pszDomain) -> char const *""" 1973 return _gdal.MajorObject_GetMetadataItem(self, *args)
1974 1975
1976 - def SetMetadataItem(self, *args):
1977 """SetMetadataItem(MajorObject self, char const * pszName, char const * pszValue, char const * pszDomain) -> CPLErr""" 1978 return _gdal.MajorObject_SetMetadataItem(self, *args)
1979 1980
1981 - def GetMetadata(self, domain=''):
1982 if domain and domain[:4] == 'xml:': 1983 return self.GetMetadata_List(domain) 1984 return self.GetMetadata_Dict(domain)
1985 1986 MajorObject_swigregister = _gdal.MajorObject_swigregister 1987 MajorObject_swigregister(MajorObject) 1988
1989 -class Driver(MajorObject):
1990 """Proxy of C++ GDALDriverShadow class.""" 1991 1992 __swig_setmethods__ = {} 1993 for _s in [MajorObject]: 1994 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) 1995 __setattr__ = lambda self, name, value: _swig_setattr(self, Driver, name, value) 1996 __swig_getmethods__ = {} 1997 for _s in [MajorObject]: 1998 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) 1999 __getattr__ = lambda self, name: _swig_getattr(self, Driver, name) 2000
2001 - def __init__(self, *args, **kwargs):
2002 raise AttributeError("No constructor defined")
2003 __repr__ = _swig_repr 2004 __swig_getmethods__["ShortName"] = _gdal.Driver_ShortName_get 2005 if _newclass: 2006 ShortName = _swig_property(_gdal.Driver_ShortName_get) 2007 __swig_getmethods__["LongName"] = _gdal.Driver_LongName_get 2008 if _newclass: 2009 LongName = _swig_property(_gdal.Driver_LongName_get) 2010 __swig_getmethods__["HelpTopic"] = _gdal.Driver_HelpTopic_get 2011 if _newclass: 2012 HelpTopic = _swig_property(_gdal.Driver_HelpTopic_get) 2013
2014 - def Create(self, *args, **kwargs):
2015 """Create(Driver self, char const * utf8_path, int xsize, int ysize, int bands=1, GDALDataType eType, char ** options=None) -> Dataset""" 2016 return _gdal.Driver_Create(self, *args, **kwargs)
2017 2018
2019 - def CreateMultiDimensional(self, *args, **kwargs):
2020 """CreateMultiDimensional(Driver self, char const * utf8_path, char ** root_group_options=None, char ** options=None) -> Dataset""" 2021 return _gdal.Driver_CreateMultiDimensional(self, *args, **kwargs)
2022 2023
2024 - def CreateCopy(self, *args, **kwargs):
2025 """CreateCopy(Driver self, char const * utf8_path, Dataset src, int strict=1, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> Dataset""" 2026 return _gdal.Driver_CreateCopy(self, *args, **kwargs)
2027 2028
2029 - def Delete(self, *args):
2030 """Delete(Driver self, char const * utf8_path) -> CPLErr""" 2031 return _gdal.Driver_Delete(self, *args)
2032 2033
2034 - def Rename(self, *args):
2035 """Rename(Driver self, char const * newName, char const * oldName) -> CPLErr""" 2036 return _gdal.Driver_Rename(self, *args)
2037 2038
2039 - def CopyFiles(self, *args):
2040 """CopyFiles(Driver self, char const * newName, char const * oldName) -> CPLErr""" 2041 return _gdal.Driver_CopyFiles(self, *args)
2042 2043
2044 - def Register(self, *args):
2045 """Register(Driver self) -> int""" 2046 return _gdal.Driver_Register(self, *args)
2047 2048
2049 - def Deregister(self, *args):
2050 """Deregister(Driver self)""" 2051 return _gdal.Driver_Deregister(self, *args)
2052 2053 Driver_swigregister = _gdal.Driver_swigregister 2054 Driver_swigregister(Driver) 2055 2056 from sys import version_info as _swig_python_version_info 2057 if _swig_python_version_info >= (2, 7, 0): 2058 from . import ogr 2059 else: 2060 import ogr 2061 del _swig_python_version_info 2062 from sys import version_info as _swig_python_version_info 2063 if _swig_python_version_info >= (2, 7, 0): 2064 from . import osr 2065 else: 2066 import osr 2067 del _swig_python_version_info
2068 -class ColorEntry(_object):
2069 """Proxy of C++ GDALColorEntry class.""" 2070 2071 __swig_setmethods__ = {} 2072 __setattr__ = lambda self, name, value: _swig_setattr(self, ColorEntry, name, value) 2073 __swig_getmethods__ = {} 2074 __getattr__ = lambda self, name: _swig_getattr(self, ColorEntry, name) 2075
2076 - def __init__(self, *args, **kwargs):
2077 raise AttributeError("No constructor defined")
2078 __repr__ = _swig_repr 2079 __swig_setmethods__["c1"] = _gdal.ColorEntry_c1_set 2080 __swig_getmethods__["c1"] = _gdal.ColorEntry_c1_get 2081 if _newclass: 2082 c1 = _swig_property(_gdal.ColorEntry_c1_get, _gdal.ColorEntry_c1_set) 2083 __swig_setmethods__["c2"] = _gdal.ColorEntry_c2_set 2084 __swig_getmethods__["c2"] = _gdal.ColorEntry_c2_get 2085 if _newclass: 2086 c2 = _swig_property(_gdal.ColorEntry_c2_get, _gdal.ColorEntry_c2_set) 2087 __swig_setmethods__["c3"] = _gdal.ColorEntry_c3_set 2088 __swig_getmethods__["c3"] = _gdal.ColorEntry_c3_get 2089 if _newclass: 2090 c3 = _swig_property(_gdal.ColorEntry_c3_get, _gdal.ColorEntry_c3_set) 2091 __swig_setmethods__["c4"] = _gdal.ColorEntry_c4_set 2092 __swig_getmethods__["c4"] = _gdal.ColorEntry_c4_get 2093 if _newclass: 2094 c4 = _swig_property(_gdal.ColorEntry_c4_get, _gdal.ColorEntry_c4_set)
2095 ColorEntry_swigregister = _gdal.ColorEntry_swigregister 2096 ColorEntry_swigregister(ColorEntry) 2097
2098 -class GCP(_object):
2099 """Proxy of C++ GDAL_GCP class.""" 2100 2101 __swig_setmethods__ = {} 2102 __setattr__ = lambda self, name, value: _swig_setattr(self, GCP, name, value) 2103 __swig_getmethods__ = {} 2104 __getattr__ = lambda self, name: _swig_getattr(self, GCP, name) 2105 __repr__ = _swig_repr 2106 __swig_setmethods__["GCPX"] = _gdal.GCP_GCPX_set 2107 __swig_getmethods__["GCPX"] = _gdal.GCP_GCPX_get 2108 if _newclass: 2109 GCPX = _swig_property(_gdal.GCP_GCPX_get, _gdal.GCP_GCPX_set) 2110 __swig_setmethods__["GCPY"] = _gdal.GCP_GCPY_set 2111 __swig_getmethods__["GCPY"] = _gdal.GCP_GCPY_get 2112 if _newclass: 2113 GCPY = _swig_property(_gdal.GCP_GCPY_get, _gdal.GCP_GCPY_set) 2114 __swig_setmethods__["GCPZ"] = _gdal.GCP_GCPZ_set 2115 __swig_getmethods__["GCPZ"] = _gdal.GCP_GCPZ_get 2116 if _newclass: 2117 GCPZ = _swig_property(_gdal.GCP_GCPZ_get, _gdal.GCP_GCPZ_set) 2118 __swig_setmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_set 2119 __swig_getmethods__["GCPPixel"] = _gdal.GCP_GCPPixel_get 2120 if _newclass: 2121 GCPPixel = _swig_property(_gdal.GCP_GCPPixel_get, _gdal.GCP_GCPPixel_set) 2122 __swig_setmethods__["GCPLine"] = _gdal.GCP_GCPLine_set 2123 __swig_getmethods__["GCPLine"] = _gdal.GCP_GCPLine_get 2124 if _newclass: 2125 GCPLine = _swig_property(_gdal.GCP_GCPLine_get, _gdal.GCP_GCPLine_set) 2126 __swig_setmethods__["Info"] = _gdal.GCP_Info_set 2127 __swig_getmethods__["Info"] = _gdal.GCP_Info_get 2128 if _newclass: 2129 Info = _swig_property(_gdal.GCP_Info_get, _gdal.GCP_Info_set) 2130 __swig_setmethods__["Id"] = _gdal.GCP_Id_set 2131 __swig_getmethods__["Id"] = _gdal.GCP_Id_get 2132 if _newclass: 2133 Id = _swig_property(_gdal.GCP_Id_get, _gdal.GCP_Id_set) 2134
2135 - def __init__(self, *args):
2136 """__init__(GDAL_GCP self, double x=0.0, double y=0.0, double z=0.0, double pixel=0.0, double line=0.0, char const * info, char const * id) -> GCP""" 2137 this = _gdal.new_GCP(*args) 2138 try: 2139 self.this.append(this) 2140 except __builtin__.Exception: 2141 self.this = this
2142 __swig_destroy__ = _gdal.delete_GCP 2143 __del__ = lambda self: None 2144
2145 - def __str__(self):
2146 str = '%s (%.2fP,%.2fL) -> (%.7fE,%.7fN,%.2f) %s '\ 2147 % (self.Id, self.GCPPixel, self.GCPLine, 2148 self.GCPX, self.GCPY, self.GCPZ, self.Info ) 2149 return str
2150
2151 - def serialize(self, with_Z=0):
2152 base = [gdalconst.CXT_Element,'GCP'] 2153 base.append([gdalconst.CXT_Attribute,'Id',[gdalconst.CXT_Text,self.Id]]) 2154 pixval = '%0.15E' % self.GCPPixel 2155 lineval = '%0.15E' % self.GCPLine 2156 xval = '%0.15E' % self.GCPX 2157 yval = '%0.15E' % self.GCPY 2158 zval = '%0.15E' % self.GCPZ 2159 base.append([gdalconst.CXT_Attribute,'Pixel',[gdalconst.CXT_Text,pixval]]) 2160 base.append([gdalconst.CXT_Attribute,'Line',[gdalconst.CXT_Text,lineval]]) 2161 base.append([gdalconst.CXT_Attribute,'X',[gdalconst.CXT_Text,xval]]) 2162 base.append([gdalconst.CXT_Attribute,'Y',[gdalconst.CXT_Text,yval]]) 2163 if with_Z: 2164 base.append([gdalconst.CXT_Attribute,'Z',[gdalconst.CXT_Text,zval]]) 2165 return base
2166 2167 GCP_swigregister = _gdal.GCP_swigregister 2168 GCP_swigregister(GCP) 2169 2170
2171 -def GDAL_GCP_GCPX_get(*args):
2172 """GDAL_GCP_GCPX_get(GCP gcp) -> double""" 2173 return _gdal.GDAL_GCP_GCPX_get(*args)
2174
2175 -def GDAL_GCP_GCPX_set(*args):
2176 """GDAL_GCP_GCPX_set(GCP gcp, double dfGCPX)""" 2177 return _gdal.GDAL_GCP_GCPX_set(*args)
2178
2179 -def GDAL_GCP_GCPY_get(*args):
2180 """GDAL_GCP_GCPY_get(GCP gcp) -> double""" 2181 return _gdal.GDAL_GCP_GCPY_get(*args)
2182
2183 -def GDAL_GCP_GCPY_set(*args):
2184 """GDAL_GCP_GCPY_set(GCP gcp, double dfGCPY)""" 2185 return _gdal.GDAL_GCP_GCPY_set(*args)
2186
2187 -def GDAL_GCP_GCPZ_get(*args):
2188 """GDAL_GCP_GCPZ_get(GCP gcp) -> double""" 2189 return _gdal.GDAL_GCP_GCPZ_get(*args)
2190
2191 -def GDAL_GCP_GCPZ_set(*args):
2192 """GDAL_GCP_GCPZ_set(GCP gcp, double dfGCPZ)""" 2193 return _gdal.GDAL_GCP_GCPZ_set(*args)
2194
2195 -def GDAL_GCP_GCPPixel_get(*args):
2196 """GDAL_GCP_GCPPixel_get(GCP gcp) -> double""" 2197 return _gdal.GDAL_GCP_GCPPixel_get(*args)
2198
2199 -def GDAL_GCP_GCPPixel_set(*args):
2200 """GDAL_GCP_GCPPixel_set(GCP gcp, double dfGCPPixel)""" 2201 return _gdal.GDAL_GCP_GCPPixel_set(*args)
2202
2203 -def GDAL_GCP_GCPLine_get(*args):
2204 """GDAL_GCP_GCPLine_get(GCP gcp) -> double""" 2205 return _gdal.GDAL_GCP_GCPLine_get(*args)
2206
2207 -def GDAL_GCP_GCPLine_set(*args):
2208 """GDAL_GCP_GCPLine_set(GCP gcp, double dfGCPLine)""" 2209 return _gdal.GDAL_GCP_GCPLine_set(*args)
2210
2211 -def GDAL_GCP_Info_get(*args):
2212 """GDAL_GCP_Info_get(GCP gcp) -> char const *""" 2213 return _gdal.GDAL_GCP_Info_get(*args)
2214
2215 -def GDAL_GCP_Info_set(*args):
2216 """GDAL_GCP_Info_set(GCP gcp, char const * pszInfo)""" 2217 return _gdal.GDAL_GCP_Info_set(*args)
2218
2219 -def GDAL_GCP_Id_get(*args):
2220 """GDAL_GCP_Id_get(GCP gcp) -> char const *""" 2221 return _gdal.GDAL_GCP_Id_get(*args)
2222
2223 -def GDAL_GCP_Id_set(*args):
2224 """GDAL_GCP_Id_set(GCP gcp, char const * pszId)""" 2225 return _gdal.GDAL_GCP_Id_set(*args)
2226
2227 -def GCPsToGeoTransform(*args):
2228 """GCPsToGeoTransform(int nGCPs, int bApproxOK=1) -> RETURN_NONE""" 2229 return _gdal.GCPsToGeoTransform(*args)
2230 -class VirtualMem(_object):
2231 """Proxy of C++ CPLVirtualMemShadow class.""" 2232 2233 __swig_setmethods__ = {} 2234 __setattr__ = lambda self, name, value: _swig_setattr(self, VirtualMem, name, value) 2235 __swig_getmethods__ = {} 2236 __getattr__ = lambda self, name: _swig_getattr(self, VirtualMem, name) 2237
2238 - def __init__(self, *args, **kwargs):
2239 raise AttributeError("No constructor defined")
2240 __repr__ = _swig_repr 2241 __swig_destroy__ = _gdal.delete_VirtualMem 2242 __del__ = lambda self: None 2243
2244 - def GetAddr(self, *args):
2245 """GetAddr(VirtualMem self)""" 2246 return _gdal.VirtualMem_GetAddr(self, *args)
2247 2248
2249 - def Pin(self, *args):
2250 """Pin(VirtualMem self, size_t start_offset=0, size_t nsize=0, int bWriteOp=0)""" 2251 return _gdal.VirtualMem_Pin(self, *args)
2252 2253 VirtualMem_swigregister = _gdal.VirtualMem_swigregister 2254 VirtualMem_swigregister(VirtualMem) 2255
2256 -class AsyncReader(_object):
2257 """Proxy of C++ GDALAsyncReaderShadow class.""" 2258 2259 __swig_setmethods__ = {} 2260 __setattr__ = lambda self, name, value: _swig_setattr(self, AsyncReader, name, value) 2261 __swig_getmethods__ = {} 2262 __getattr__ = lambda self, name: _swig_getattr(self, AsyncReader, name) 2263
2264 - def __init__(self, *args, **kwargs):
2265 raise AttributeError("No constructor defined")
2266 __repr__ = _swig_repr 2267 __swig_destroy__ = _gdal.delete_AsyncReader 2268 __del__ = lambda self: None 2269
2270 - def GetNextUpdatedRegion(self, *args):
2271 """GetNextUpdatedRegion(AsyncReader self, double timeout) -> GDALAsyncStatusType""" 2272 return _gdal.AsyncReader_GetNextUpdatedRegion(self, *args)
2273 2274
2275 - def GetBuffer(self, *args):
2276 """GetBuffer(AsyncReader self)""" 2277 return _gdal.AsyncReader_GetBuffer(self, *args)
2278 2279
2280 - def LockBuffer(self, *args):
2281 """LockBuffer(AsyncReader self, double timeout) -> int""" 2282 return _gdal.AsyncReader_LockBuffer(self, *args)
2283 2284
2285 - def UnlockBuffer(self, *args):
2286 """UnlockBuffer(AsyncReader self)""" 2287 return _gdal.AsyncReader_UnlockBuffer(self, *args)
2288 2289 AsyncReader_swigregister = _gdal.AsyncReader_swigregister 2290 AsyncReader_swigregister(AsyncReader) 2291
2292 -class Dataset(MajorObject):
2293 """Proxy of C++ GDALDatasetShadow class.""" 2294 2295 __swig_setmethods__ = {} 2296 for _s in [MajorObject]: 2297 __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) 2298 __setattr__ = lambda self, name, value: _swig_setattr(self, Dataset, name, value) 2299 __swig_getmethods__ = {} 2300 for _s in [MajorObject]: 2301 __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) 2302 __getattr__ = lambda self, name: _swig_getattr(self, Dataset, name) 2303
2304 - def __init__(self, *args, **kwargs):
2305 raise AttributeError("No constructor defined")
2306 __repr__ = _swig_repr 2307 __swig_getmethods__["RasterXSize"] = _gdal.Dataset_RasterXSize_get 2308 if _newclass: 2309 RasterXSize = _swig_property(_gdal.Dataset_RasterXSize_get) 2310 __swig_getmethods__["RasterYSize"] = _gdal.Dataset_RasterYSize_get 2311 if _newclass: 2312 RasterYSize = _swig_property(_gdal.Dataset_RasterYSize_get) 2313