# osgeo.gdal module

osgeo.gdal.AbortPendingUploads(char const * utf8_path) → bool

osgeo.gdal.ApplyHomography(double [9] padfHomography, double dfPixel, double dfLine) → int

osgeo.gdal.ApplyVerticalShiftGrid(Dataset src_ds, Dataset grid_ds, bool inverse=False, double srcUnitToMeter=1.0, double dstUnitToMeter=1.0, char ** options=None) → Dataset

class osgeo.gdal.ArgDatasetValue(*args, **kwargs)

  Bases: `object`

  Proxy of C++ GDALArgDatasetValueHS class.

  GetDataset(ArgDatasetValue self) → Dataset
  GetName(ArgDatasetValue self) → char const *
  SetDataset(ArgDatasetValue self, Dataset ds)
  SetName(ArgDatasetValue self, char const * name)

class osgeo.gdal.AsyncReader(*args, **kwargs)

  Bases: `object`

  Proxy of C++ GDALAsyncReaderShadow class.

  GetBuffer(AsyncReader self)
  GetNextUpdatedRegion(AsyncReader self, double timeout) → GDALAsyncStatusType
  LockBuffer(AsyncReader self, double timeout) → int
  UnlockBuffer(AsyncReader self)

osgeo.gdal.CPLBinaryToHex(int nBytes) → retStringAndCPLFree *

osgeo.gdal.CPLHexToBinary(char const * pszHex, int * pnBytes) → GByte *

osgeo.gdal.CPLReadLineL(VSILFILE fp) → char const *

osgeo.gdal.ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, GDALProgressFunc callback=0, void * callback_data=None) → int

osgeo.gdal.CreateRasterAttributeTableFromMDArrays(GDALRATTableType eTableType, int nArrays, int nUsages=0) → RasterAttributeTable

osgeo.gdal.DecToDMS(double arg1, char const * arg2, int arg3=2) → char const *

osgeo.gdal.DecToPackedDMS(double dfDec) → double

osgeo.gdal.DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, GDALProgressFunc callback=0, void * callback_data=None) → int

class osgeo.gdal.EDTComponent(*args, **kwargs)

  Bases: `object`

  Proxy of C++ GDALEDTComponentHS class.

  static Create(char const * name, size_t offset, ExtendedDataType type) → EDTComponent
  GetName(EDTComponent self) → char const *
  GetOffset(EDTComponent self) → size_t
  GetType(EDTComponent self) → ExtendedDataType

osgeo.gdal.EscapeBinary(int len, int scheme=CPLES_SQL)

osgeo.gdal.EscapeString(string_or_bytes, scheme=gdal.CPLES_SQL)

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

osgeo.gdal.FinderClean()

osgeo.gdal.GCPsToGeoTransform(int nGCPs, int bApproxOK=1) → RETURN_NONE

osgeo.gdal.GCPsToHomography(int nGCPs) → RETURN_NONE

class osgeo.gdal.GDALContourOptions(*args)

  Bases: `object`

  Proxy of C++ GDALContourOptions class.

osgeo.gdal.GDALDestroyDriverManager()

class osgeo.gdal.GDALTransformerInfoShadow(*args, **kwargs)

  Bases: `object`

  Proxy of C++ GDALTransformerInfoShadow class.

  TransformGeolocations(GDALTransformerInfoShadow self, Band xBand, Band yBand, Band zBand, GDALProgressFunc callback=0, void * callback_data=None, char ** options=None) → int
  TransformPoint(GDALTransformerInfoShadow self, int bDstToSrc, double [3] inout) → int
  TransformPoint(GDALTransformerInfoShadow self, int bDstToSrc, double x, double y, double z=0.0) → int
  TransformPoints(GDALTransformerInfoShadow self, int bDstToSrc, int nCount) → int

osgeo.gdal.GDAL_GCP_GCPLine_get(GCP gcp) → double

osgeo.gdal.GDAL_GCP_GCPLine_set(GCP gcp, double dfGCPLine)

osgeo.gdal.GDAL_GCP_GCPPixel_get(GCP gcp) → double

osgeo.gdal.GDAL_GCP_GCPPixel_set(GCP gcp, double dfGCPPixel)

osgeo.gdal.GDAL_GCP_GCPX_get(GCP gcp) → double

osgeo.gdal.GDAL_GCP_GCPX_set(GCP gcp, double dfGCPX)

osgeo.gdal.GDAL_GCP_GCPY_get(GCP gcp) → double

osgeo.gdal.GDAL_GCP_GCPY_set(GCP gcp, double dfGCPY)

osgeo.gdal.GDAL_GCP_GCPZ_get(GCP gcp) → double

osgeo.gdal.GDAL_GCP_GCPZ_set(GCP gcp, double dfGCPZ)

osgeo.gdal.GDAL_GCP_Id_get(GCP gcp) → char const *

osgeo.gdal.GDAL_GCP_Id_set(GCP gcp, char const * pszId)

osgeo.gdal.GDAL_GCP_Info_get(GCP gcp) → char const *

osgeo.gdal.GDAL_GCP_Info_set(GCP gcp, char const * pszInfo)

osgeo.gdal.GOA2GetAccessToken(char const * pszRefreshToken, char const * pszScope) → retStringAndCPLFree *

osgeo.gdal.GOA2GetAuthorizationURL(char const * pszScope) → retStringAndCPLFree *

osgeo.gdal.GOA2GetRefreshToken(char const * pszAuthToken, char const * pszScope) → retStringAndCPLFree *

osgeo.gdal.GeneralCmdLineProcessor(char ** papszArgv, int nOptions=0) → char **

osgeo.gdal.GetActualURL(char const * utf8_path) → char const *

osgeo.gdal.GetColorInterpretationByName(char const * pszColorInterpName) → GDALColorInterp

osgeo.gdal.GetColorInterpretationName(GDALColorInterp eColorInterp) → char const *

osgeo.gdal.GetCurrentThreadCount() → int

osgeo.gdal.GetJPEG2000Structure(char const * pszFilename, char ** options=None) → CPLXMLNode *

osgeo.gdal.GetJPEG2000StructureAsString(char const * pszFilename, char ** options=None) → retStringAndCPLFree *

osgeo.gdal.GetNextDirEntry(VSIDIR * dir) → DirEntry

osgeo.gdal.GetPaletteInterpretationName(GDALPaletteInterp ePaletteInterp) → char const *

osgeo.gdal.GetSignedURL(char const * utf8_path, char ** options=None) → retStringAndCPLFree *

osgeo.gdal.GetSubdatasetInfo(char const * pszFileName) → GDALSubdatasetInfoShadow *

osgeo.gdal.GetTranformerOptionList() → char const *

osgeo.gdal.HasTriangulation() → int

osgeo.gdal.InvHomography(double [9] h_in) → RETURN_NONE

osgeo.gdal.IsLineOfSightVisible(Band band, int xA, int yA, double zA, int xB, int yB, double zB, char ** options=None)

  Check Line of Sight between two points. Both input coordinates must be within the raster coordinate bounds.

  > See `GDALIsLineOfSightVisible()`.

  Added in version 3.9.

  Parameters:

    - band (Band) -- The band to read the DEM data from. This must NOT be null.

    - xA (int) -- The X location (raster column) of the first point to check on the raster.

    - yA (int) -- The Y location (raster row) of the first point to check on the raster.

    - zA (float) -- The Z location (height) of the first point to check.

    - xB (int) -- The X location (raster column) of the second point to check on the raster.

    - yB (int) -- The Y location (raster row) of the second point to check on the raster.

    - zB (float) -- The Z location (height) of the second point to check.

    - options (dict or list, optional) -- A dict or list of name=value of options for the line of sight algorithm (currently ignored).

  Returns:

    A named tuple with the following fields:

    - `is_visible` (bool): True if the two points are within Line of Sight.

    - `col_intersection` (int): Raster column index where the LOS line intersects terrain. Will be set in the future; currently -1.

    - `row_intersection` (int): Raster row index where the LOS line intersects terrain. Will be set in the future; currently -1.

  Return type:

    tuple

class osgeo.gdal.MajorObject(*args, **kwargs)

  Bases: `object`

  Proxy of C++ GDALMajorObjectShadow class.

  GetDescription(MajorObject self) → char const *
  GetMetadata(domain='')
  GetMetadataDomainList(MajorObject self) → char **
  GetMetadataItem(MajorObject self, char const * pszName, char const * pszDomain="") → char const *
  GetMetadata_Dict(MajorObject self, char const * pszDomain="") → char **
  GetMetadata_List(MajorObject self, char const * pszDomain="") → char **
  SetDescription(MajorObject self, char const * pszNewDesc)
  SetMetadata(MajorObject self, char ** papszMetadata, char const * pszDomain="") → CPLErr
  SetMetadata(MajorObject self, char * pszMetadataString, char const * pszDomain="") → CPLErr
  SetMetadataItem(MajorObject self, char const * pszName, char const * pszValue, char const * pszDomain="") → CPLErr

osgeo.gdal.MultipartUploadAbort(char const * pszFilename, char const * pszUploadId, char ** options=None) → bool

osgeo.gdal.MultipartUploadAddPart(char const * pszFilename, char const * pszUploadId, int nPartNumber, GUIntBig nFileOffset, size_t nDataLength, char ** options=None) → retStringAndCPLFree *

osgeo.gdal.MultipartUploadEnd(char const * pszFilename, char const * pszUploadId, char ** partIds, GUIntBig nTotalSize, char ** options=None) → bool

osgeo.gdal.MultipartUploadGetCapabilities(char const * pszFilename)

osgeo.gdal.MultipartUploadStart(char const * pszFilename, char ** options=None) → retStringAndCPLFree *

osgeo.gdal.NetworkStatsGetAsSerializedJSON(char ** options=None) → retStringAndCPLFree *

osgeo.gdal.NetworkStatsReset()

osgeo.gdal.PackedDMSToDec(double dfPacked) → double

osgeo.gdal.ParseCommandLine(char const * utf8_path) → char **

osgeo.gdal.ParseXMLString(char * pszXMLString) → CPLXMLNode *

osgeo.gdal.PopFinderLocation()

osgeo.gdal.PushFinderLocation(char const * utf8_path)

osgeo.gdal.RGBFile2PCTFile(src_filename, dst_filename)

class osgeo.gdal.RawBlockInfo(*args)

  Bases: `object`

  Proxy of C++ GDALMDArrayRawBlockInfo class.

  GetFilename(RawBlockInfo self) → char const *
  GetInfo(RawBlockInfo self) → char **
  GetInlineData(RawBlockInfo self)
  GetOffset(RawBlockInfo self) → GUIntBig
  GetSize(RawBlockInfo self) → GUIntBig

osgeo.gdal.ReprojectImage(Dataset src_ds, Dataset dst_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg=GRA_NearestNeighbour, double WarpMemoryLimit=0.0, double maxerror=0.0, GDALProgressFunc callback=0, void * callback_data=None, char ** options=None) → CPLErr

  Reproject image.

  See `GDALReprojectImage()`.

  Consider using `osgeo.gdal.Warp()` and `osgeo.gdal.WarpOptions()` instead

osgeo.gdal.SerializeXMLTree(CPLXMLNode * xmlnode) → retStringAndCPLFree *

class osgeo.gdal.StatBuf(*args)

  Bases: `object`

  Proxy of C++ StatBuf class.

  IsDirectory(StatBuf self) → int
  property mode

    int

    Type:

      mode

  property mtime

    GIntBig

    Type:

      mtime

  property size

    GIntBig

    Type:

      size

class osgeo.gdal.Statistics(*args)

  Bases: `object`

  Proxy of C++ Statistics class.

  property max

    double

    Type:

      max

  property min

    double

    Type:

      min

  property std_dev

    double

    Type:

      std_dev

  property valid_count

    GIntBig

    Type:

      valid_count

class osgeo.gdal.SubdatasetInfo(*args, **kwargs)

  Bases: `object`

  Proxy of C++ GDALSubdatasetInfoShadow class.

  GetPathComponent(SubdatasetInfo self) → retStringAndCPLFree *
  GetSubdatasetComponent(SubdatasetInfo self) → retStringAndCPLFree *
  ModifyPathComponent(SubdatasetInfo self, char const * pszNewFileName) → retStringAndCPLFree *

osgeo.gdal.SuggestedWarpOutputFromOptions(Dataset src, char ** options) → SuggestedWarpOutputRes

osgeo.gdal.SuggestedWarpOutputFromTransformer(Dataset src, GDALTransformerInfoShadow transformer) → SuggestedWarpOutputRes

class osgeo.gdal.SuggestedWarpOutputRes(*args, **kwargs)

  Bases: `object`

  Proxy of C++ SuggestedWarpOutputRes class.

  GetGeotransform(SuggestedWarpOutputRes self)
  property geotransform

    double[6]

    Type:

      geotransform

  property height

    int

    Type:

      height

  property width

    int

    Type:

      width

  property xmax

    double

    Type:

      xmax

  property xmin

    double

    Type:

      xmin

  property ymax

    double

    Type:

      ymax

  property ymin

    double

    Type:

      ymin

osgeo.gdal.TermProgress_nocb(double dfProgress, char const * pszMessage=None, void * pData=None) → int

osgeo.gdal.Transformer(Dataset src, Dataset dst, char ** options) → GDALTransformerInfoShadow

osgeo.gdal.VSICurlClearCache()

osgeo.gdal.VSICurlPartialClearCache(char const * utf8_path)

osgeo.gdal.VSIErrorReset()

osgeo.gdal.VSIFClearErrL(VSILFILE fp)

osgeo.gdal.VSIFCloseL(VSILFILE fp) → VSI_RETVAL

osgeo.gdal.VSIFEofL(VSILFILE fp) → int

osgeo.gdal.VSIFErrorL(VSILFILE fp) → int

osgeo.gdal.VSIFFlushL(VSILFILE fp) → int

osgeo.gdal.VSIFGetRangeStatusL(VSILFILE fp, GIntBig offset, GIntBig length) → int

osgeo.gdal.VSIFOpenExL(char const * utf8_path, char const * pszMode, int bSetError=FALSE, char ** options=None) → VSILFILE

osgeo.gdal.VSIFOpenL(char const * utf8_path, char const * pszMode) → VSILFILE

osgeo.gdal.VSIFReadL(unsigned int nMembSize, unsigned int nMembCount, VSILFILE fp) → unsigned int

osgeo.gdal.VSIFSeekL(VSILFILE fp, GIntBig offset, int whence) → int

osgeo.gdal.VSIFTellL(VSILFILE fp) → GIntBig

osgeo.gdal.VSIFTruncateL(VSILFILE fp, GIntBig length) → int

osgeo.gdal.VSIFWriteL(int nLen, int size, int memb, VSILFILE fp) → int

osgeo.gdal.VSIGetLastErrorMsg() → char const *

osgeo.gdal.VSIGetLastErrorNo() → int

osgeo.gdal.VSIGetMemFileBuffer_unsafe(char const * utf8_path)

class osgeo.gdal.VSILFILE(*args, **kwargs)

  Bases: `object`

  Proxy of C++ VSILFILE class.

osgeo.gdal.VSIStatL(char const * utf8_path, int nFlags=0) → int

osgeo.gdal.VSISupportsSparseFiles(char const * utf8_path) → int

class osgeo.gdal.VirtualMem(*args, **kwargs)

  Bases: `object`

  Proxy of C++ CPLVirtualMemShadow class.

  GetAddr(VirtualMem self)
  Pin(VirtualMem self, size_t start_offset=0, size_t nsize=0, int bWriteOp=0)

osgeo.gdal.WarpGetOptionList() → char const *

class osgeo.gdal.Window(xoff, yoff, xsize, ysize)

  Bases: `object`

  property xoff
  property xsize
  property yoff
  property ysize

osgeo.gdal.deprecation_warn(module, sub_package=None, new_module=None)

osgeo.gdal.listdir(path, recursionLevel=-1, options=[])

  Iterate over a directory.

  recursionLevel = -1 means unlimited level of recursion.

osgeo.gdal.reregister_gdal_alg()

  Destroys current gdal.alg module and recreates it