# Utilities API

## Raster Utilities

osgeo.gdal.AutoCreateWarpedVRT(Dataset src_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg=GRA_NearestNeighbour, double maxerror=0.0) → Dataset

osgeo.gdal.BuildVRT(destName, srcDSOrSrcDSTab, **kwargs)

  Build a VRT from a list of datasets.

  Parameters:

    - destName -- Output dataset name.

    - srcDSOrSrcDSTab -- An array of Dataset objects or filenames, or a Dataset object or a filename.

    - kwargs -- options: return of gdal.BuildVRTOptions(), string or array of strings, other keywords arguments of gdal.BuildVRTOptions(). If options is provided as a gdal.BuildVRTOptions() object, other keywords are ignored.

osgeo.gdal.BuildVRTOptions(options=None, resolution=None, outputBounds=None, xRes=None, yRes=None, targetAlignedPixels=None, separate=None, bandList=None, addAlpha=None, resampleAlg=None, outputSRS=None, allowProjectionDifference=None, srcNodata=None, VRTNodata=None, hideNodata=None, nodataMaxMaskThreshold=None, strict=False, creationOptions=None, callback=None, callback_data=None)

  Create a BuildVRTOptions() object that can be passed to gdal.BuildVRT()

  Parameters:

    - options (l) -- can be be an array of strings, a string or let empty and filled from other keywords.

    - resolution -- 'highest', 'lowest', 'average', 'user'.

    - outputBounds (l) -- output bounds as (minX, minY, maxX, maxY) in target SRS.

    - xRes -- output resolution in target SRS.

    - yRes -- output resolution in target SRS.

    - targetAlignedPixels -- whether to force output bounds to be multiple of output resolution.

    - separate -- whether each source file goes into a separate stacked band in the VRT band.

    - bandList -- array of band numbers (index start at 1).

    - addAlpha -- whether to add an alpha mask band to the VRT when the source raster have none.

    - resampleAlg -- resampling mode.

    - outputSRS -- assigned output SRS.

    - allowProjectionDifference -- whether to accept input datasets have not the same projection. Note: they will not be reprojected.

    - srcNodata -- source nodata value(s).

    - VRTNodata -- nodata values at the VRT band level.

    - hideNodata -- whether to make the VRT band not report the NoData value.

    - nodataMaxMaskThreshold -- value of the mask band of a source below which the source band values should be replaced by VRTNodata (or 0 if not specified)

    - strict -- set to True if warnings should be failures

    - creationOptions -- list or dict of creation options

    - callback -- callback method.

    - callback_data -- user data for callback.

osgeo.gdal.CreatePansharpenedVRT(char const * pszXML, Band panchroBand, int nInputSpectralBands) → Dataset

osgeo.gdal.ContourGenerate(Band srcBand, double contourInterval, double contourBase, int fixedLevelCount, int useNoData, double noDataValue, Layer dstLayer, int idField, int elevField, GDALProgressFunc callback=0, void * callback_data=None) → int

osgeo.gdal.ContourGenerateEx(Band srcBand, Layer dstLayer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) → int

osgeo.gdal.DEMProcessing(destName, srcDS, processing, **kwargs)

  Apply a DEM processing.

  Parameters:

    - destName -- Output dataset name

    - srcDS -- a Dataset object or a filename

    - processing -- one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness"

    - kwargs -- options: return of gdal.DEMProcessingOptions(), string or array of strings, other keywords arguments of gdal.DEMProcessingOptions(). If options is provided as a gdal.DEMProcessingOptions() object, other keywords are ignored.

osgeo.gdal.DEMProcessingOptions(options=None, colorFilename=None, format=None, creationOptions=None, computeEdges=False, alg=None, band=1, zFactor=None, scale=None, xscale=None, yscale=None, azimuth=None, altitude=None, combined=False, multiDirectional=False, igor=False, slopeFormat=None, trigonometric=False, zeroForFlat=False, addAlpha=None, colorSelection=None, callback=None, callback_data=None)

  Create a DEMProcessingOptions() object that can be passed to gdal.DEMProcessing()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - colorFilename -- (mandatory for "color-relief") name of file that contains palette definition for the "color-relief" processing.

    - format -- output format ("GTiff", etc...)

    - creationOptions -- list or dict of creation options

    - computeEdges -- whether to compute values at raster edges.

    - alg -- 'Horn' (default) or 'ZevenbergenThorne' for hillshade, slope or aspect. 'Wilson' (default) or 'Riley' for TRI

    - band -- source band number to use

    - zFactor -- (hillshade only) vertical exaggeration used to pre-multiply the elevations.

    - scale -- ratio of vertical units to horizontal.

    - xscale -- Ratio of vertical units to horizontal X axis units.

    - yscale -- Ratio of vertical units to horizontal Y axis units.

    - 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.

    - altitude -- (hillshade only) altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.

    - 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.

    - multiDirectional -- (hillshade only) whether to compute multi-directional shading. Only one of combined, multiDirectional and igor can be specified.

    - igor -- (hillshade only) whether to use Igor's hillshading from Maperitive. Only one of combined, multiDirectional and igor can be specified.

    - slopeFormat -- (slope only) "degree" or "percent".

    - trigonometric -- (aspect only) whether to return trigonometric angle instead of azimuth. Thus 0deg means East, 90deg North, 180deg West, 270deg South.

    - zeroForFlat -- (aspect only) whether to return 0 for flat areas with slope=0, instead of -9999.

    - addAlpha -- adds an alpha band to the output file (only for processing = 'color-relief')

    - 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"

    - callback -- callback method

    - callback_data -- user data for callback

osgeo.gdal.Footprint(destNameOrDestDS, srcDS, **kwargs)

  Compute the footprint of a raster

  Parameters:

    - destNameOrDestDS --

      Output dataset name or object

      If passed as a dataset name, a potentially existing output dataset of the same name will be overwritten. To update an existing output dataset, it must be passed as a dataset object.

    - srcDS -- a Dataset object or a filename

    - kwargs -- options: return of gdal.FootprintOptions(), string or array of strings, other keywords arguments of gdal.FootprintOptions() If options is provided as a gdal.FootprintOptions() object, other keywords are ignored.

  Examples

  1. Special mode to get deserialized GeoJSON (in EPSG:4326 if dstSRS not specified):

      >>> deserialized_geojson = gdal.Footprint(None, src_ds, format="GeoJSON")

  2. Special mode to get WKT:

      >>> wkt = gdal.Footprint(None, src_ds, format="WKT")

  3. Get result in a GeoPackage

      >>> gdal.Footprint("out.gpkg", src_ds, format="GPKG")

osgeo.gdal.FootprintOptions(options=None, format=None, bands=None, combineBands=None, srcNodata=None, ovr=None, targetCoordinateSystem=None, dstSRS=None, splitPolys=None, convexHull=None, densify=None, simplify=None, maxPoints=None, minRingArea=None, layerName=None, locationFieldName='location', writeAbsolutePath=False, layerCreationOptions=None, datasetCreationOptions=None, callback=None, callback_data=None)

  Create a FootprintOptions() object that can be passed to gdal.Footprint()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GeoJSON", etc...)

    - bands -- list of output bands to burn values into

    - combineBands -- how to combine bands: "union" (default) or "intersection"

    - srcNodata -- source nodata value(s).

    - ovr -- overview index.

    - targetCoordinateSystem -- "pixel" or "georef"

    - dstSRS -- output SRS

    - datasetCreationOptions -- list or dict of dataset creation options

    - layerCreationOptions -- list or dict of layer creation options

    - splitPolys -- whether to split multipolygons as several polygons

    - convexHull -- whether to compute the convex hull of polygons/multipolygons

    - densify -- tolerance value for polygon densification

    - simplify -- tolerance value for polygon simplification

    - maxPoints -- maximum number of points (100 by default, "unlimited" for unlimited)

    - minRingArea -- Minimum value for the area of a ring The unit of the area is in square pixels if targetCoordinateSystem equals "pixel", or otherwise in georeferenced units of the target vector dataset. This option is applied after the reprojection implied by dstSRS

    - locationFieldName -- Specifies the name of the field in the resulting vector dataset where the path of the input dataset will be stored. The default field name is "location". Can be set to None to disable creation of such field.

    - writeAbsolutePath -- Enables writing the absolute path of the input dataset. By default, the filename is written in the location field exactly as the dataset name.

    - layerName -- output layer name

    - callback -- callback method

    - callback_data -- user data for callback

osgeo.gdal.FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) → int

  Fill selected raster regions by interpolation from the edges.

  This algorithm will interpolate values for all designated nodata pixels (marked by zeros in `maskBand`). For each pixel a four direction conic search is done to find values to interpolate from (using inverse distance weighting by default). Once all values are interpolated, zero or more smoothing iterations (3x3 average filters on interpolated pixels) are applied to smooth out artifacts.

  This algorithm is generally suitable for interpolating missing regions of fairly continuously varying rasters (such as elevation models for instance). It is also suitable for filling small holes and cracks in more irregularly varying images (like airphotos). It is generally not so great for interpolating a raster from sparse point data. See `Grid()` for that case.

  See `GDALFillNodata()`.

  Parameters:

    - targetBand (Band) -- Band containing values to fill. Will be modified in-place.

    - maskBand (Band) -- Mask band with a value of 0 indicating values that should be filled. If not specified, the mask band associated with `targetBand` will be used.

    - maxSearchDist (float) -- the maximum number of pixels to search in all directions to find values to interpolate from.

    - smoothingIterations (int) -- the number of 3x3 smoothing filter passes to run (0 or more)

    - options (dict/list, optional) -- A dict or list of name=value options. Available options are described in `GDALFillNodata()`.

    - callback (function, optional) -- A progress callback function

    - callback_data (optional) -- Optional data to be passed to callback function

  Returns:

    `CE_None` on success or `CE_Failure` on failure.

  Return type:

    int

  Examples

      >>> import numpy as np
      >>> data = np.array([[1, 2], [9, 9], [9, 9], [3, 4]], dtype=np.float32)
      >>> ds = gdal.GetDriverByName('MEM').Create('', 2, 4, eType=gdal.GDT_Float32)
      >>> ds.WriteArray(data)
      0
      >>> mask = data != 9  # replace pixels with value = 9
      >>> mask_ds = gdal.GetDriverByName('MEM').Create('', 2, 4, eType=gdal.GDT_Byte)
      >>> mask_ds.WriteArray(mask)
      0
      >>> gdal.FillNodata(ds.GetRasterBand(1), mask_ds.GetRasterBand(1), 5, 0)
      0
      >>> ds.ReadAsArray()
      array([[1.       , 2.       ],
             [2.1485982, 2.6666667],
             [2.721169 , 3.3333333],
             [3.       , 4.       ]], dtype=float32)
      >>> gdal.FillNodata(ds.GetRasterBand(1), mask_ds.GetRasterBand(1), 5, 0, {'INTERPOLATION':'NEAREST'})
      0
      >>> ds.ReadAsArray()
      array([[1., 2.],
             [1., 2.],
             [3., 4.],
             [3., 4.]], dtype=float32)

osgeo.gdal.Grid(destName, srcDS, **kwargs)

  Create raster from the scattered data.

  Parameters:

    - destName -- Output dataset name

    - srcDS -- a Dataset object or a filename

    - kwargs -- options: return of gdal.GridOptions(), string or array of strings, other keywords arguments of gdal.GridOptions() If options is provided as a gdal.GridOptions() object, other keywords are ignored.

osgeo.gdal.GridOptions(options=None, format=None, outputType=0, width=0, height=0, creationOptions=None, outputBounds=None, outputSRS=None, noData=None, algorithm=None, layers=None, SQLStatement=None, where=None, spatFilter=None, zfield=None, z_increase=None, z_multiply=None, callback=None, callback_data=None)

  Create a GridOptions() object that can be passed to gdal.Grid()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GTiff", etc...)

    - outputType -- output type (gdalconst.GDT_Byte, etc...)

    - width -- width of the output raster in pixel

    - height -- height of the output raster in pixel

    - creationOptions -- list or dict of creation options

    - outputBounds -- assigned output bounds: [ulx, uly, lrx, lry]

    - outputSRS -- assigned output SRS

    - noData -- nodata value

    - 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"

    - layers -- list of layers to convert

    - SQLStatement -- SQL statement to apply to the source dataset

    - where -- WHERE clause to apply to source layer(s)

    - spatFilter -- spatial filter as (minX, minY, maxX, maxY) bounding box

    - 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.

    - 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.

    - 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.

    - callback -- callback method

    - callback_data -- user data for callback

osgeo.gdal.Info(ds, **kwargs)

  Return information on a raster dataset.

  Parameters:

    - ds -- a Dataset object or a filename

    - kwargs -- options: return of gdal.InfoOptions(), string or array of strings other keywords arguments of gdal.InfoOptions(). If options is provided as a gdal.InfoOptions() object, other keywords are ignored.

osgeo.gdal.InfoOptions(options=None, format='text', deserialize=True, computeMinMax=False, reportHistograms=False, reportProj4=False, stats=False, approxStats=False, computeChecksum=False, showGCPs=True, showMetadata=True, showRAT=True, showColorTable=True, showNodata=True, showMask=True, listMDD=False, showFileList=True, allMetadata=False, extraMDDomains=None, wktFormat=None)

  Create a InfoOptions() object that can be passed to gdal.Info() options can be be an array of strings, a string or let empty and filled from other keywords.

osgeo.gdal.Nearblack(destNameOrDestDS, srcDS, **kwargs)

  Convert nearly black/white borders to exact value.

  Parameters:

    - destNameOrDestDS --

      Output dataset name or object

      If passed as a dataset name, a potentially existing output dataset of the same name will be overwritten. To update an existing output dataset, it must be passed as a dataset object.

    - srcDS -- a Dataset object or a filename

    - kwargs -- options: return of gdal.NearblackOptions(), string or array of strings, other keywords arguments of gdal.NearblackOptions(). If options is provided as a gdal.NearblackOptions() object, other keywords are ignored.

osgeo.gdal.NearblackOptions(options=None, format=None, creationOptions=None, white=False, colors=None, maxNonBlack=None, nearDist=None, setAlpha=False, setMask=False, alg=None, callback=None, callback_data=None)

  Create a NearblackOptions() object that can be passed to gdal.Nearblack()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GTiff", etc...)

    - creationOptions -- list or dict of creation options

    - white -- whether to search for nearly white (255) pixels instead of nearly black pixels.

    - 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

    - 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.

    - 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.

    - setAlpha -- adds an alpha band to the output file.

    - setMask -- adds a mask band to the output file.

    - alg -- "twopasses" (default), or "floodfill"

    - callback -- callback method

    - callback_data -- user data for callback

osgeo.gdal.Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) → int

osgeo.gdal.Rasterize(destNameOrDestDS, srcDS, **kwargs)

  Burns vector geometries into a raster

  Parameters:

    - destNameOrDestDS --

      Output dataset name or object.

      If passed as a dataset name, a potentially existing output dataset of the same name will be overwritten. To update an existing output dataset, it must be passed as a dataset object.

    - srcDS -- a Dataset object or a filename

    - kwargs -- options: return of gdal.RasterizeOptions(), string or array of strings, other keywords arguments of gdal.RasterizeOptions() If options is provided as a gdal.RasterizeOptions() object, other keywords are ignored.

osgeo.gdal.RasterizeOptions(options=None, format=None, outputType=0, creationOptions=None, noData=None, initValues=None, outputBounds=None, outputSRS=None, transformerOptions=None, width=None, height=None, xRes=None, yRes=None, targetAlignedPixels=False, bands=None, inverse=False, allTouched=False, burnValues=None, attribute=None, useZ=False, layers=None, SQLStatement=None, SQLDialect=None, where=None, optim=None, add=None, callback=None, callback_data=None)

  Create a RasterizeOptions() object that can be passed to gdal.Rasterize()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GTiff", etc...)

    - outputType -- output type (gdalconst.GDT_Byte, etc...)

    - creationOptions -- list or dict of creation options

    - outputBounds -- assigned output bounds: [minx, miny, maxx, maxy]

    - outputSRS -- assigned output SRS

    - transformerOptions -- list or dict of transformer options

    - width -- width of the output raster in pixel

    - height -- height of the output raster in pixel

    - xRes -- output resolution in target SRS

    - yRes -- output resolution in target SRS

    - targetAlignedPixels -- whether to force output bounds to be multiple of output resolution

    - noData -- nodata value

    - 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.

    - bands -- list of output bands to burn values into

    - 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.

    - 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.

    - burnValues -- list of fixed values to burn into each band for all objects. Exclusive with attribute.

    - 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. Exclusive with burnValues.

    - 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.

    - layers -- list of layers from the datasource that will be used for input features.

    - SQLStatement -- SQL statement to apply to the source dataset

    - SQLDialect -- SQL dialect ('OGRSQL', 'SQLITE', ...)

    - where -- WHERE clause to apply to source layer(s)

    - optim -- optimization mode ('RASTER', 'VECTOR')

    - add -- set to True to use additive mode instead of replace when burning values

    - callback -- callback method

    - callback_data -- user data for callback

osgeo.gdal.RasterizeLayer(Dataset dataset, int bands, Layer layer, void * pfnTransformer=None, void * pTransformArg=None, int burn_values=0, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) → int

osgeo.gdal.SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness=4, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) → int

osgeo.gdal.SuggestedWarpOutput(*args)

  Suggest output dataset size and extent.

  SuggestedWarpOutput(src: Dataset, transformer: Transformer) -> SuggestedWarpOutputRes SuggestedWarpOutput(src: Dataset, options: list[str]) -> SuggestedWarpOutputRes

  This function is used to suggest the size, and georeferenced extents appropriate given the indicated transformation and input file. It walks the edges of the input file (approximately 20 sample points along each edge) transforming into output coordinates in order to get an extents box.

  Then a resolution is computed with the intent that the length of the distance from the top left corner of the output imagery to the bottom right corner would represent the same number of pixels as in the source image. Note that if the image is somewhat rotated the diagonal taken isn't of the whole output bounding rectangle, but instead of the locations where the top/left and bottom/right corners transform. The output pixel size is always square. This is intended to approximately preserve the resolution of the input data in the output file.

  There are 2 forms of this method:

  - one that takes the output of gdal.Transformer(src, dst, options) as the second argument. The src argument of the gdal.Transformer() call should nominally be the src argument passed to this function. The dst argument of the gdal.Transformer() call should nominally be None The third argument of the gdal.Transformer() call should be a list of strings, that are transforming options accepted by `GDALCreateGenImgProjTransformer2()` (e.g `DST_SRS`)

  - one that takes a list of strings as the second argument. Those strings are the transforming options accepted by `GDALCreateGenImgProjTransformer2()` (e.g `DST_SRS`)

  Parameters:

    - src (Dataset) -- Source dataset

    - transformer (Transformer) -- The return value of gdal.Transformer(src, None, options) (exclusive with below options parameter)

    - options (list[str]) -- List of strings that are the transforming options accepted by `GDALCreateGenImgProjTransformer2()` (e.g `DST_SRS`) (exclusive with above transformer parameter)

  Returns:

    - A SuggestedWarpOutputRes class instance with the following members

    - - width (number of pixels in width of the output dataset)

    - - height (number of pixels in height of the output dataset)

    - - xmin (minimum value of the georeferenced X coordinates)

    - - ymin (maximum value of the georeferenced Y coordinates)

    - - xmax (minimum value of the georeferenced X coordinates)

    - - ymax (maximum value of the georeferenced Y coordinates)

    - - geotransform (affine geotransformation matrix (6 values))

  Example

      >>> ds = gdal.Open("my.tif")
      ... res = gdal.SuggestedWarpOutput(ds, ["DST_SRS=EPSG:4326"])
      ... print(res.width, res.height, res.xmin, res.ymin, res.xmax, res.ymax, res.geotransform)

osgeo.gdal.TileIndex(destName, srcFilenames, **kwargs)

  Build a tileindex from a list of datasets.

  Parameters:

    - destName -- Output dataset name.

    - srcFilenames -- An array of filenames.

    - kwargs -- options: return of gdal.TileIndexOptions(), string or array of strings, other keywords arguments of gdal.TileIndexOptions(). If options is provided as a gdal.TileIndexOptions() object, other keywords are ignored.

osgeo.gdal.TileIndexOptions(options=None, overwrite=None, recursive=None, filenameFilter=None, minPixelSize=None, maxPixelSize=None, format=None, layerName=None, layerCreationOptions=None, locationFieldName='location', outputSRS=None, writeAbsolutePath=None, skipDifferentProjection=None, gtiFilename=None, xRes=None, yRes=None, outputBounds=None, colorInterpretation=None, noData=None, bandCount=None, mask=None, metadataOptions=None, fetchMD=None)

  Create a TileIndexOptions() object that can be passed to gdal.TileIndex()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - overwrite -- Whether to overwrite the existing tile index

    - recursive -- Whether directories specified in source filenames should be explored recursively

    - filenameFilter -- Pattern that the filenames contained in directories pointed by <file_or_dir> should follow. '*' and '?' wildcard can be used. String or list of strings.

    - minPixelSize -- Minimum pixel size in term of geospatial extent per pixel (resolution) that a raster should have to be selected.

    - maxPixelSize -- Maximum pixel size in term of geospatial extent per pixel (resolution) that a raster should have to be selected.

    - format -- output format ("ESRI Shapefile", "GPKG", etc...)

    - layerName -- output layer name

    - layerCreationOptions -- list or dict of layer creation options

    - locationFieldName -- Specifies the name of the field in the resulting vector dataset where the path of the input dataset will be stored. The default field name is "location". Can be set to None to disable creation of such field.

    - outputSRS -- assigned output SRS

    - writeAbsolutePath -- Enables writing the absolute path of the input dataset. By default, the filename is written in the location field exactly as the dataset name.

    - skipDifferentProjection -- Whether to skip sources that have a different SRS

    - gtiFilename -- Filename of the GDAL XML Tile Index file

    - xRes -- output horizontal resolution

    - yRes -- output vertical resolution

    - outputBounds -- output bounds as [minx, miny, maxx, maxy]

    - colorInterpretation -- Tile color interpretation, as a single value or a list, of the following values ("red", "green", "blue", "alpha", "grey", "undefined", etc.) or their GCI_xxxx symbolic names

    - noData -- tile nodata value, as a single value or a list

    - bandCount -- number of band of tiles in the index

    - mask -- whether tiles have a band mask

    - metadataOptions -- list or dict of metadata options

    - fetchMD -- Fetch a metadata item from the raster tile and write it as a field in the tile index. Tuple (raster metadata item name, target field name, target field type), or list of such tuples, with target field type in "String", "Integer", "Integer64", "Real", "Date", "DateTime";

osgeo.gdal.Translate(destName, srcDS, **kwargs)

  Convert a dataset.

  Parameters:

    - destName -- Output dataset name

    - srcDS -- a Dataset object or a filename

    - kwargs -- options: return of gdal.TranslateOptions(), string or array of strings other keywords arguments of gdal.TranslateOptions(). If options is provided as a gdal.TranslateOptions() object, other keywords are ignored.

osgeo.gdal.TranslateOptions(options=None, format=None, outputType=0, bandList=None, maskBand=None, width=0, height=0, widthPct=0.0, heightPct=0.0, xRes=0.0, yRes=0.0, creationOptions=None, srcWin=None, projWin=None, projWinSRS=None, strict=False, unscale=False, scaleParams=None, exponents=None, outputBounds=None, outputGeotransform=None, metadataOptions=None, outputSRS=None, nogcp=False, GCPs=None, noData=None, rgbExpand=None, stats=False, rat=True, xmp=True, resampleAlg=None, overviewLevel='AUTO', colorInterpretation=None, callback=None, callback_data=None, domainMetadataOptions=None, errorIfWindowOutsideSource=False)

  Create a TranslateOptions() object that can be passed to gdal.Translate()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GTiff", etc...)

    - outputType -- output type (gdalconst.GDT_Byte, etc...)

    - bandList -- array of band numbers (index start at 1)

    - maskBand -- mask band to generate or not ("none", "auto", "mask", 1, ...)

    - width -- width of the output raster in pixel

    - height -- height of the output raster in pixel

    - widthPct -- width of the output raster in percentage (100 = original width)

    - heightPct -- height of the output raster in percentage (100 = original height)

    - xRes -- output horizontal resolution

    - yRes -- output vertical resolution

    - creationOptions -- list or dict of creation options

    - srcWin -- subwindow in pixels to extract: [left_x, top_y, width, height]

    - projWin -- subwindow in projected coordinates to extract: [ulx, uly, lrx, lry]

    - projWinSRS -- SRS in which projWin is expressed

    - strict -- strict mode

    - unscale -- unscale values with scale and offset metadata

    - scaleParams -- list of scale parameters, each of the form [src_min,src_max] or [src_min,src_max,dst_min,dst_max]

    - exponents -- list of exponentiation parameters

    - outputBounds -- assigned output bounds: [ulx, uly, lrx, lry]

    - outputGeotransform -- assigned geotransform matrix (array of 6 values) (mutually exclusive with outputBounds)

    - metadataOptions -- list or dict of metadata options

    - outputSRS -- assigned output SRS

    - nogcp -- ignore GCP in the raster

    - GCPs -- list of GCPs

    - noData -- nodata value (or "none" to unset it)

    - rgbExpand -- Color palette expansion mode: "gray", "rgb", "rgba"

    - stats -- whether to calculate statistics

    - rat -- whether to write source RAT

    - xmp -- whether to copy XMP metadata

    - resampleAlg -- resampling mode

    - overviewLevel -- To specify which overview level of source files must be used

    - colorInterpretation -- Band color interpretation, as a single value or a list, of the following values ("red", "green", "blue", "alpha", "grey", "undefined", etc.) or their GCI_xxxx symbolic names

    - callback -- callback method

    - callback_data -- user data for callback

    - domainMetadataOptions -- list or dict of domain-specific metadata options

    - errorIfWindowOutsideSource ({True, False, "partially", "completely"}, default=True) -- raise an error if the requested window is partially or completely outside the source dataset. ("True" is a synonym for "partially"). This corresponds to the `-epo` and `-eco` options of `gdal_translate`.

osgeo.gdal.ViewshedGenerate(Band srcBand, char const * driverName, char const * targetRasterName, char ** creationOptions, double observerX, double observerY, double observerHeight, double targetHeight, double visibleVal, double invisibleVal, double outOfRangeVal, double noDataVal, double dfCurvCoeff, GDALViewshedMode mode, double maxDistance, GDALProgressFunc callback=0, void * callback_data=None, GDALViewshedOutputType heightMode=GVOT_NORMAL, char ** options=None) → Dataset

osgeo.gdal.Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs)

  Warp one or several datasets.

  Parameters:

    - destNameOrDestDS --

      Output dataset name or object.

      If passed as a dataset name, a potentially existing output dataset of the same name will be overwritten. To update an existing output dataset, it must be passed as a dataset object.

    - srcDSOrSrcDSTab -- an array of Dataset objects or filenames, or a Dataset object or a filename

    - kwargs -- options: return of gdal.WarpOptions(), string or array of strings, other keywords arguments of gdal.WarpOptions(). If options is provided as a gdal.WarpOptions() object, other keywords are ignored.

osgeo.gdal.WarpOptions(options=None, format=None, srcBands=None, dstBands=None, outputBounds=None, outputBoundsSRS=None, xRes=None, yRes=None, targetAlignedPixels=False, width=0, height=0, srcSRS=None, dstSRS=None, coordinateOperation=None, srcAlpha=None, dstAlpha=False, warpOptions=None, errorThreshold=None, warpMemoryLimit=None, creationOptions=None, outputType=0, workingType=0, resampleAlg=None, srcNodata=None, dstNodata=None, multithread=False, tps=False, rpc=False, geoloc=False, polynomialOrder=None, transformerOptions=None, cutlineDSName=None, cutlineWKT=None, cutlineSRS=None, cutlineLayer=None, cutlineWhere=None, cutlineSQL=None, cutlineBlend=None, cropToCutline=False, copyMetadata=True, metadataConflictValue=None, setColorInterpretation=False, overviewLevel='AUTO', callback=None, callback_data=None)

  Create a WarpOptions() object that can be passed to gdal.Warp()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GTiff", etc...)

    - srcBands -- list of source band numbers (between 1 and the number of input bands)

    - dstBands -- list of output band numbers

    - outputBounds -- output bounds as (minX, minY, maxX, maxY) in target SRS

    - outputBoundsSRS -- SRS in which output bounds are expressed, in the case they are not expressed in dstSRS

    - xRes -- output resolution in target SRS

    - yRes -- output resolution in target SRS

    - targetAlignedPixels -- whether to force output bounds to be multiple of output resolution

    - width -- width of the output raster in pixel

    - height -- height of the output raster in pixel

    - srcSRS -- source SRS

    - dstSRS -- output SRS

    - coordinateOperation -- coordinate operation as a PROJ string or WKT string

    - srcAlpha -- whether to force the last band of the input dataset to be considered as an alpha band. If set to False, source alpha warping will be disabled.

    - dstAlpha -- whether to force the creation of an output alpha band

    - outputType -- output type (gdalconst.GDT_Byte, etc...)

    - workingType -- working type (gdalconst.GDT_Byte, etc...)

    - warpOptions -- list or dict of warping options. For a list of available options, see `GDALWarpOptions::papszWarpOptions`.

    - errorThreshold -- error threshold for approximation transformer (in pixels)

    - warpMemoryLimit -- size of working buffer in MB

    - resampleAlg -- resampling mode

    - creationOptions -- list or dict of creation options

    - srcNodata -- source nodata value(s)

    - dstNodata -- output nodata value(s)

    - multithread -- whether to multithread computation and I/O operations

    - tps -- whether to use Thin Plate Spline GCP transformer

    - rpc -- whether to use RPC transformer

    - geoloc -- whether to use GeoLocation array transformer

    - polynomialOrder -- order of polynomial GCP interpolation

    - transformerOptions -- list or dict of transformer options

    - cutlineDSName -- cutline dataset name (mutually exclusive with cutlineWKT)

    - cutlineWKT -- cutline WKT geometry (POLYGON or MULTIPOLYGON) (mutually exclusive with cutlineDSName)

    - cutlineSRS -- set/override cutline SRS

    - cutlineLayer -- cutline layer name

    - cutlineWhere -- cutline WHERE clause

    - cutlineSQL -- cutline SQL statement

    - cutlineBlend -- cutline blend distance in pixels

    - cropToCutline -- whether to use cutline extent for output bounds

    - copyMetadata -- whether to copy source metadata

    - metadataConflictValue -- metadata data conflict value

    - setColorInterpretation -- whether to force color interpretation of input bands to output bands

    - overviewLevel -- To specify which overview level of source files must be used

    - callback -- callback method

    - callback_data -- user data for callback

## Multidimensional Raster Utilities

osgeo.gdal.MultiDimInfo(ds, **kwargs)

  Return information on a dataset.

  Parameters:

    - ds -- a Dataset object or a filename

    - kwargs -- options: return of gdal.MultiDimInfoOptions(), string or array of strings other keywords arguments of gdal.MultiDimInfoOptions(). If options is provided as a gdal.MultiDimInfoOptions() object, other keywords are ignored.

osgeo.gdal.MultiDimInfoOptions(options=None, detailed=False, array=None, arrayoptions=None, limit=None, as_text=False)

  Create a MultiDimInfoOptions() object that can be passed to gdal.MultiDimInfo() options can be be an array of strings, a string or let empty and filled from other keywords.

osgeo.gdal.MultiDimTranslate(destName, srcDSOrSrcDSTab, **kwargs)

  MultiDimTranslate one or several datasets.

  Parameters:

    - destName -- Output dataset name

    - srcDSOrSrcDSTab -- an array of Dataset objects or filenames, or a Dataset object or a filename

    - kwargs -- options: return of gdal.MultiDimTranslateOptions(), string or array of strings other keywords arguments of gdal.MultiDimTranslateOptions(). If options is provided as a gdal.MultiDimTranslateOptions() object, other keywords are ignored.

osgeo.gdal.MultiDimTranslateOptions(options=None, format=None, creationOptions=None, arraySpecs=None, arrayOptions=None, groupSpecs=None, subsetSpecs=None, scaleAxesSpecs=None, callback=None, callback_data=None)

  Create a MultiDimTranslateOptions() object that can be passed to gdal.MultiDimTranslate()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- output format ("GTiff", etc...)

    - creationOptions -- list or dict of creation options

    - 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]"

    - arrayOptions -- list of options passed to GDALGroup.GetMDArrayNames to filter reported arrays.

    - groupSpecs -- list of group specifications, each of them being a group name or "name={src_array_name},dstname={dst_name},recursive=no"

    - subsetSpecs -- list of subset specifications, each of them being like "{dim_name}({min_val},{max_val})" or "{dim_name}({slice_va})"

    - scaleAxesSpecs -- list of dimension scaling specifications, each of them being like "{dim_name}({scale_factor})"

    - callback -- callback method

    - callback_data -- user data for callback

## Vector Utilities

osgeo.gdal.VectorInfo(ds, **kwargs)

  Return information on a vector dataset.

  Parameters:

    - ds -- a Dataset object or a filename

    - kwargs -- options: return of gdal.VectorInfoOptions(), string or array of strings other keywords arguments of gdal.VectorInfoOptions(). If options is provided as a gdal.VectorInfoOptions() object, other keywords are ignored.

osgeo.gdal.VectorInfoOptions(options=None, format='text', deserialize=True, layers=None, dumpFeatures=False, limit=None, featureCount=True, extent=True, SQLStatement=None, SQLDialect=None, where=None, wktFormat=None)

  Create a VectorInfoOptions() object that can be passed to gdal.VectorInfo() options can be be an array of strings, a string or let empty and filled from other keywords.

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- "text" or "json"

    - deserialize -- if JSON output should be returned as a Python dictionary. Otherwise as a serialized representation.

    - SQLStatement -- SQL statement to apply to the source dataset

    - SQLDialect -- SQL dialect ('OGRSQL', 'SQLITE', ...)

    - where -- WHERE clause to apply to source layer(s)

    - layers -- list of layers of interest

    - featureCount -- whether to compute and display the feature count

    - extent -- whether to compute and display the layer extent. Can also be set to the string '3D' to request a 3D extent

    - dumpFeatures -- set to True to get the dump of all features

    - limit -- maximum number of features to read per layer

osgeo.gdal.VectorTranslate(destNameOrDestDS, srcDS, **kwargs)

  Convert one vector dataset

  Parameters:

    - destNameOrDestDS --

      Output dataset name or object

      If passed as a dataset name, a potentially existing output dataset of the same name will be overwritten. To update an existing output dataset, it must be passed as a dataset object. Note that the accessMode parameter also controls, at the layer level, if existing layers must be overwritten or updated.

    - srcDS -- a Dataset object or a filename

    - kwargs -- options: return of gdal.VectorTranslateOptions(), string or array of strings, other keywords arguments of gdal.VectorTranslateOptions(). If options is provided as a gdal.VectorTranslateOptions() object, other keywords are ignored.

osgeo.gdal.VectorTranslateOptions(options=None, format=None, accessMode=None, srcSRS=None, dstSRS=None, reproject=True, coordinateOperation=None, coordinateOperationOptions=None, SQLStatement=None, SQLDialect=None, where=None, selectFields=None, addFields=False, relaxedFieldNameMatch=False, forceNullable=False, emptyStrAsNull=False, spatFilter=None, spatSRS=None, datasetCreationOptions=None, layerCreationOptions=None, layers=None, layerName=None, geometryType=None, dim=None, transactionSize=None, clipSrc=None, clipSrcSQL=None, clipSrcLayer=None, clipSrcWhere=None, clipDst=None, clipDstSQL=None, clipDstLayer=None, clipDstWhere=None, preserveFID=False, simplifyTolerance=None, segmentizeMaxDist=None, makeValid=False, skipInvalid=False, mapFieldType=None, explodeCollections=False, zField=None, resolveDomains=False, skipFailures=False, limit=None, xyRes=None, zRes=None, mRes=None, setCoordPrecision=True, callback=None, callback_data=None)

  Create a VectorTranslateOptions() object that can be passed to gdal.VectorTranslate()

  Parameters:

    - options -- can be be an array of strings, a string or let empty and filled from other keywords.

    - format -- format ("ESRI Shapefile", etc...)

    - accessMode -- None for creation, 'update', 'append', 'upsert', 'overwrite'

    - srcSRS -- source SRS

    - dstSRS -- output SRS (with reprojection if reproject = True)

    - coordinateOperation -- coordinate operation as a PROJ string or WKT string

    - coordinateOperationOptions -- list or dict of coordinate operation options (ALLOW_BALLPARK=NO, ONLY_BEST=YES, WARN_ABOUT_DIFFERENT_COORD_OP=NO)

    - reproject -- whether to do reprojection

    - SQLStatement -- SQL statement to apply to the source dataset

    - SQLDialect -- SQL dialect ('OGRSQL', 'SQLITE', ...)

    - where -- WHERE clause to apply to source layer(s)

    - selectFields -- list of fields to select

    - addFields -- whether to add new fields found in source layers (to be used with accessMode == 'append' or 'upsert')

    - relaxedFieldNameMatch -- Do field name matching between source and existing target layer in a more relaxed way if the target driver has an implementation for it.

    - forceNullable -- whether to drop NOT NULL constraints on newly created fields

    - emptyStrAsNull -- whether to treat empty string values as NULL

    - spatFilter -- spatial filter as (minX, minY, maxX, maxY) bounding box

    - spatSRS -- SRS in which the spatFilter is expressed. If not specified, it is assumed to be the one of the layer(s)

    - datasetCreationOptions -- list or dict of dataset creation options

    - layerCreationOptions -- list or dict of layer creation options

    - layers -- list of layers to convert

    - layerName -- output layer name

    - geometryType -- output layer geometry type ('POINT', ....). May be an array of strings when using a special value like 'PROMOTE_TO_MULTI', 'CONVERT_TO_LINEAR', 'CONVERT_TO_CURVE' combined with another one or a geometry type.

    - dim -- output dimension ('XY', 'XYZ', 'XYM', 'XYZM', 'layer_dim')

    - transactionSize -- number of features to save per transaction (default 100 000). Increase the value for better performance when writing into DBMS drivers that have transaction support. Set to "unlimited" to load the data into a single transaction.

    - clipSrc -- clip geometries to the specified bounding box (expressed in source SRS), WKT geometry (POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of the -spat option if you use the "spat_extent" keyword. When specifying a datasource, you will generally want to use it in combination with the clipSrcLayer, clipSrcWhere or clipSrcSQL options.

    - clipSrcSQL -- select desired geometries using an SQL query instead.

    - clipSrcLayer -- select the named layer from the source clip datasource.

    - clipSrcWhere -- restrict desired geometries based on attribute query.

    - clipDst -- clip geometries after reprojection to the specified bounding box (expressed in dest SRS), WKT geometry (POLYGON or MULTIPOLYGON) or from a datasource. When specifying a datasource, you will generally want to use it in combination of the clipDstLayer, clipDstWhere or clipDstSQL options.

    - clipDstSQL -- select desired geometries using an SQL query instead.

    - clipDstLayer -- select the named layer from the destination clip datasource.

    - clipDstWhere -- restrict desired geometries based on attribute query.

    - simplifyTolerance -- distance tolerance for simplification. The algorithm used preserves topology per feature, in particular for polygon geometries, but not for a whole layer.

    - segmentizeMaxDist -- maximum distance between consecutive nodes of a line geometry

    - makeValid -- run MakeValid() on geometries

    - skipInvalid -- whether to skip features with invalid geometries regarding the rules of the Simple Features specification.

    - mapFieldType -- converts any field of the specified type to another type. Valid types are: Integer, Integer64, Real, String, Date, Time, DateTime, Binary, IntegerList, Integer64List, RealList, StringList. Types can also include subtype between parenthesis, such as Integer(Boolean), Real(Float32),... Special value All can be used to convert all fields to another type. This is an alternate way to using the CAST operator of OGR SQL, that may avoid typing a long SQL query. Note that this does not influence the field types used by the source driver, and is only an afterwards conversion.

    - explodeCollections -- produce one feature for each geometry in any kind of geometry collection in the source file, applied after any -sql option. This option is not compatible with preserveFID but a SQLStatement (e.g. SELECT fid AS original_fid, * FROM ...) can be used to store the original FID if needed.

    - preserveFID -- Use the FID of the source features instead of letting the output driver automatically assign a new one (for formats that require a FID). If not in append mode, this behavior is the default if the output driver has a FID layer creation option, in which case the name of the source FID column will be used and source feature IDs will be attempted to be preserved. This behavior can be disabled by setting -unsetFid. This option is not compatible with explodeCollections

    - zField -- name of field to use to set the Z component of geometries

    - resolveDomains -- whether to create an additional field for each field associated with a coded field domain.

    - skipFailures -- whether to skip failures

    - limit -- maximum number of features to read per layer

    - xyRes -- Geometry X,Y coordinate resolution. Numeric value, or numeric value suffixed with " m", " mm" or "deg".

    - zRes -- Geometry Z coordinate resolution. Numeric value, or numeric value suffixed with " m" or " mm".

    - mRes -- Geometry M coordinate resolution. Numeric value.

    - setCoordPrecision -- Set to False to unset the geometry coordinate precision.

    - callback -- callback method

    - callback_data -- user data for callback