456 | | gdal.Info() can be used either with setting the attributes of gdal.InfoOptions() or inlined arguments of gdal.Info(). |
457 | | Arguments can be specified as array of strings, command line syntax or dedeicated keywords. |
458 | | So various combinations are possible : |
459 | | |
460 | | {{{ |
461 | | options = gdal.InfoOptions(format = 'json', computeChecksum = True) |
462 | | gdal.Info(ds, options) |
463 | | }}} |
464 | | |
465 | | {{{ |
466 | | options = gdal.InfoOptions(options = ['-json', '-checksum']) |
467 | | gdal.Info(ds, options) |
468 | | }}} |
469 | | |
470 | | {{{ |
471 | | options = gdal.InfoOptions(options = '-json -checksum') |
472 | | gdal.Info(ds, options) |
473 | | }}} |
474 | | |
475 | | {{{ |
476 | | gdal.Info(ds, format = 'json', computeChecksum = True) |
477 | | }}} |
478 | | |
479 | | {{{ |
480 | | gdal.Info(ds, options = ['-json', '-checksum']) |
481 | | }}} |
482 | | |
483 | | {{{ |
484 | | gdal.Info(ds, options = '-json -checksum') |
485 | | }}} |
486 | | |
487 | | Same for gdal.Translate() |
| 494 | {{{ |
| 495 | |
| 496 | def DEMProcessingOptions(options = [], colorFilename = None, format = 'GTiff', |
| 497 | creationOptions = None, computeEdges = False, alg = 'Horn', band = 1, |
| 498 | zFactor = None, scale = None, azimuth = None, altitude = None, combined = False, |
| 499 | slopeFormat = None, trigonometric = False, zeroForFlat = False, |
| 500 | callback = None, callback_data = None): |
| 501 | """ Create a DEMProcessingOptions() object that can be passed to gdal.DEMProcessing() |
| 502 | Keyword arguments are : |
| 503 | options --- can be be an array of strings, a string or let empty and filled from other keywords. |
| 504 | colorFilename --- (mandatory for "color-relief") name of file that contains palette definition for the "color-relief" processing. |
| 505 | format --- output format ("GTiff", etc...) |
| 506 | creationOptions --- list of creation options |
| 507 | computeEdges --- whether to compute values at raster edges. |
| 508 | alg --- 'ZevenbergenThorne' or 'Horn' |
| 509 | band --- source band number to use |
| 510 | zFactor --- (hillshade only) vertical exaggeration used to pre-multiply the elevations. |
| 511 | scale --- ratio of vertical units to horizontal. |
| 512 | 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. |
| 513 | altitude ---(hillshade only) altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light. |
| 514 | combined --- (hillshade only) whether to compute combined shading, a combination of slope and oblique shading. |
| 515 | slopeformat --- (slope only) "degree" or "percent". |
| 516 | trigonometric --- (aspect only) whether to return trigonometric angle instead of azimuth. Thus 0deg means East, 90deg North, 180deg West, 270deg South. |
| 517 | zeroForFlat --- (aspect only) whether to return 0 for flat areas with slope=0, instead of -9999. |
| 518 | callback --- callback method |
| 519 | callback_data --- user data for callback |
| 520 | """ |
| 521 | |
| 522 | def DEMProcessing(destName, srcDS, processing, **kwargs): |
| 523 | """ Apply a DEM processing. |
| 524 | Arguments are : |
| 525 | destName --- Output dataset name |
| 526 | srcDS --- a Dataset object or a filename |
| 527 | processing --- one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness" |
| 528 | Keyword arguments are : |
| 529 | options --- return of gdal.InfoOptions(), string or array of strings |
| 530 | other keywords arguments of gdal.DEMProcessingOptions() |
| 531 | If options is provided as a gdal.DEMProcessingOptions() object, other keywords are ignored. """ |
| 532 | }}} |
| 533 | |
| 534 | {{{ |
| 535 | def NearblackOptions(options = [], format = 'GTiff', |
| 536 | creationOptions = None, white = False, colors = None, |
| 537 | maxNonBlack = None, nearDist = None, setAlpha = False, setMask = False, |
| 538 | callback = None, callback_data = None): |
| 539 | """ Create a NearblackOptions() object that can be passed to gdal.Nearblack() |
| 540 | Keyword arguments are : |
| 541 | options --- can be be an array of strings, a string or let empty and filled from other keywords. |
| 542 | format --- output format ("GTiff", etc...) |
| 543 | creationOptions --- list of creation options |
| 544 | white --- whether to search for nearly white (255) pixels instead of nearly black pixels. |
| 545 | 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 |
| 546 | 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. |
| 547 | 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. |
| 548 | setAlpha --- adds an alpha band if the output file. |
| 549 | setMask --- adds a mask band to the output file. |
| 550 | callback --- callback method |
| 551 | callback_data --- user data for callback |
| 552 | """ |
| 553 | |
| 554 | def Nearblack(destNameOrDestDS, srcDS, **kwargs): |
| 555 | """ Convert nearly black/white borders to exact value. |
| 556 | Arguments are : |
| 557 | destNameOrDestDS --- Output dataset name or object |
| 558 | srcDS --- a Dataset object or a filename |
| 559 | Keyword arguments are : |
| 560 | options --- return of gdal.InfoOptions(), string or array of strings |
| 561 | other keywords arguments of gdal.NearblackOptions() |
| 562 | If options is provided as a gdal.NearblackOptions() object, other keywords are ignored. """ |
| 563 | }}} |
| 564 | |
| 565 | {{{ |
| 566 | def GridOptions(options = [], format = 'GTiff', |
| 567 | outputType = GDT_Unknown, |
| 568 | width = 0, height = 0, |
| 569 | creationOptions = None, |
| 570 | outputBounds = None, |
| 571 | outputSRS = None, |
| 572 | noData = None, |
| 573 | algorithm = None, |
| 574 | layers = None, |
| 575 | SQLStatement = None, |
| 576 | where = None, |
| 577 | spatFilter = None, |
| 578 | zfield = None, |
| 579 | z_increase = None, |
| 580 | z_multiply = None, |
| 581 | callback = None, callback_data = None): |
| 582 | """ Create a GridOptions() object that can be passed to gdal.Grid() |
| 583 | Keyword arguments are : |
| 584 | options --- can be be an array of strings, a string or let empty and filled from other keywords. |
| 585 | format --- output format ("GTiff", etc...) |
| 586 | outputType --- output type (gdal.GDT_Byte, etc...) |
| 587 | width --- width of the output raster in pixel |
| 588 | height --- height of the output raster in pixel |
| 589 | creationOptions --- list of creation options |
| 590 | outputBounds --- assigned output bounds: [ulx, uly, lrx, lry] |
| 591 | outputSRS --- assigned output SRS |
| 592 | noData --- nodata value |
| 593 | 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" |
| 594 | layers --- list of layers to convert |
| 595 | SQLStatement --- SQL statement to apply to the source dataset |
| 596 | where --- WHERE clause to apply to source layer(s) |
| 597 | spatFilter --- spatial filter as (minX, minY, maxX, maxY) bounding box |
| 598 | 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. |
| 599 | 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. |
| 600 | 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. |
| 601 | callback --- callback method |
| 602 | callback_data --- user data for callback |
| 603 | """ |
| 604 | |
| 605 | def Grid(destName, srcDS, **kwargs): |
| 606 | """ Create raster from the scattered data. |
| 607 | Arguments are : |
| 608 | destName --- Output dataset name |
| 609 | srcDS --- a Dataset object or a filename |
| 610 | Keyword arguments are : |
| 611 | options --- return of gdal.InfoOptions(), string or array of strings |
| 612 | other keywords arguments of gdal.GridOptions() |
| 613 | If options is provided as a gdal.GridOptions() object, other keywords are ignored. """ |
| 614 | }}} |
| 615 | |
| 616 | {{{ |
| 617 | def RasterizeOptions(options = [], format = None, |
| 618 | creationOptions = None, noData = None, initValues = None, |
| 619 | outputBounds = None, outputSRS = None, |
| 620 | width = None, height = None, |
| 621 | xRes = None, yRes = None, targetAlignedPixels = False, |
| 622 | bands = None, inverse = False, allTouched = False, |
| 623 | burnValues = None, attribute = None, useZ = False, layers = None, |
| 624 | SQLStatement = None, SQLDialect = None, where = None, |
| 625 | callback = None, callback_data = None): |
| 626 | """ Create a RasterizeOptions() object that can be passed to gdal.Rasterize() |
| 627 | Keyword arguments are : |
| 628 | options --- can be be an array of strings, a string or let empty and filled from other keywords. |
| 629 | format --- output format ("GTiff", etc...) |
| 630 | creationOptions --- list of creation options |
| 631 | outputBounds --- assigned output bounds: [minx, miny, maxx, maxy] |
| 632 | outputSRS --- assigned output SRS |
| 633 | width --- width of the output raster in pixel |
| 634 | height --- height of the output raster in pixel |
| 635 | xRes, yRes --- output resolution in target SRS |
| 636 | targetAlignedPixels --- whether to force output bounds to be multiple of output resolution |
| 637 | noData --- nodata value |
| 638 | 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. |
| 639 | bands --- list of output bands to burn values into |
| 640 | inverse --- whether to invert rasterization, ie 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. |
| 641 | 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. |
| 642 | burnValues -- list of fixed values to burn into each band for all objects. Excusive with attribute. |
| 643 | 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. |
| 644 | 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. |
| 645 | layers --- list of layers from the datasource that will be used for input features. |
| 646 | SQLStatement --- SQL statement to apply to the source dataset |
| 647 | SQLDialect --- SQL dialect ('OGRSQL', 'SQLITE', ...) |
| 648 | where --- WHERE clause to apply to source layer(s) |
| 649 | callback --- callback method |
| 650 | callback_data --- user data for callback |
| 651 | """ |
| 652 | |
| 653 | def Rasterize(destNameOrDestDS, srcDS, **kwargs): |
| 654 | """ Burns vector geometries into a raster |
| 655 | Arguments are : |
| 656 | destNameOrDestDS --- Output dataset name or object |
| 657 | srcDS --- a Dataset object or a filename |
| 658 | Keyword arguments are : |
| 659 | options --- return of gdal.InfoOptions(), string or array of strings |
| 660 | other keywords arguments of gdal.RasterizeOptions() |
| 661 | If options is provided as a gdal.RasterizeOptions() object, other keywords are ignored. """ |
| 662 | }}} |