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

Source Code for Module osgeo.gdal

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