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