osgeo.gdal module

osgeo.gdal.AbortPendingUploads(path) bool
osgeo.gdal.ApplyHomography(padfHomography, dfPixel, 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(self) Dataset
GetName(self) char const *
SetDataset(self, ds)
SetName(self, name)
class osgeo.gdal.AsyncReader(*args, **kwargs)

Bases: object

Proxy of C++ GDALAsyncReaderShadow class.

GetBuffer(self)
GetNextUpdatedRegion(self, timeout) GDALAsyncStatusType
LockBuffer(self, timeout) int
UnlockBuffer(self)
osgeo.gdal.CPLBinaryToHex(nBytes) retStringAndCPLFree *
osgeo.gdal.CPLHexToBinary(pszHex, pnBytes) GByte *
osgeo.gdal.CPLReadLineL(fp) char const *
osgeo.gdal.ClearMemoryCaches()
osgeo.gdal.ComputeMedianCutPCT(red, green, blue, num_colors, colors, callback=0, callback_data=None) int
osgeo.gdal.CreateRasterAttributeTableFromMDArrays(eTableType, nArrays, nUsages=0) RasterAttributeTable
osgeo.gdal.DecToDMS(arg1, arg2, arg3=2) char const *
osgeo.gdal.DecToPackedDMS(dfDec) double
osgeo.gdal.DitherRGB2PCT(red, green, blue, target, colors, callback=0, callback_data=None) int
class osgeo.gdal.EDTComponent(*args, **kwargs)

Bases: object

Proxy of C++ GDALEDTComponentHS class.

static Create(name, offset, type) EDTComponent
GetName(self) char const *
GetOffset(self) size_t
GetType(self) ExtendedDataType
osgeo.gdal.EscapeBinary(len, scheme=CPLES_SQL)
osgeo.gdal.EscapeString(string_or_bytes, scheme=gdal.CPLES_SQL)
osgeo.gdal.FPolygonize(srcBand, maskBand, outLayer, iPixValField, options=None, callback=0, callback_data=None) int
osgeo.gdal.FinderClean()
osgeo.gdal.GCPsToGeoTransform(nGCPs, bApproxOK=1) RETURN_NONE
osgeo.gdal.GCPsToHomography(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(self, xBand, yBand, zBand, callback=0, callback_data=None, options=None) int
TransformPoint(self, bDstToSrc, inout) int
TransformPoint(self, bDstToSrc, x, y, z=0.0) int
TransformPoints(self, bDstToSrc, nCount) int
osgeo.gdal.GDAL_GCP_GCPLine_get(gcp) double
osgeo.gdal.GDAL_GCP_GCPLine_set(gcp, dfGCPLine)
osgeo.gdal.GDAL_GCP_GCPPixel_get(gcp) double
osgeo.gdal.GDAL_GCP_GCPPixel_set(gcp, dfGCPPixel)
osgeo.gdal.GDAL_GCP_GCPX_get(gcp) double
osgeo.gdal.GDAL_GCP_GCPX_set(gcp, dfGCPX)
osgeo.gdal.GDAL_GCP_GCPY_get(gcp) double
osgeo.gdal.GDAL_GCP_GCPY_set(gcp, dfGCPY)
osgeo.gdal.GDAL_GCP_GCPZ_get(gcp) double
osgeo.gdal.GDAL_GCP_GCPZ_set(gcp, dfGCPZ)
osgeo.gdal.GDAL_GCP_Id_get(gcp) char const *
osgeo.gdal.GDAL_GCP_Id_set(gcp, pszId)
osgeo.gdal.GDAL_GCP_Info_get(gcp) char const *
osgeo.gdal.GDAL_GCP_Info_set(gcp, pszInfo)
osgeo.gdal.GOA2GetAccessToken(pszRefreshToken, pszScope) retStringAndCPLFree *
osgeo.gdal.GOA2GetAuthorizationURL(pszScope) retStringAndCPLFree *
osgeo.gdal.GOA2GetRefreshToken(pszAuthToken, pszScope) retStringAndCPLFree *
osgeo.gdal.GeneralCmdLineProcessor(papszArgv, nOptions=0) char **
osgeo.gdal.GetActualURL(path) char const *
osgeo.gdal.GetColorInterpretationByName(pszColorInterpName) GDALColorInterp
osgeo.gdal.GetColorInterpretationName(eColorInterp) char const *
osgeo.gdal.GetCurrentThreadCount() int
osgeo.gdal.GetJPEG2000Structure(path, options=None) CPLXMLNode *
osgeo.gdal.GetJPEG2000StructureAsString(path, options=None) retStringAndCPLFree *
osgeo.gdal.GetNextDirEntry(dir) DirEntry
osgeo.gdal.GetPaletteInterpretationName(ePaletteInterp) char const *
osgeo.gdal.GetSignedURL(path, options=None) retStringAndCPLFree *
osgeo.gdal.GetSubdatasetInfo(pszFileName) GDALSubdatasetInfoShadow *
osgeo.gdal.GetTranformerOptionList() char const *
osgeo.gdal.HasTriangulation() int
osgeo.gdal.InvHomography(h_in) RETURN_NONE
osgeo.gdal.IsLineOfSightVisible(band, xA, yA, zA, xB, yB, zB, options=None)

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

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.

  • row_intersection (int): Raster row index where the LOS line intersects terrain.

Return type:

tuple

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

Bases: object

Proxy of C++ GDALMajorObjectShadow class.

GetDescription(self) char const *
GetMetadata(domain='')
GetMetadataDomainList(self) char **
GetMetadataItem(self, pszName, pszDomain='') char const *
GetMetadata_Dict(self, pszDomain='') char **
GetMetadata_List(self, pszDomain='') char **
SetDescription(self, pszNewDesc)
SetMetadata(self, papszMetadata, pszDomain='') CPLErr
SetMetadata(self, pszMetadataString, pszDomain='') CPLErr
SetMetadataItem(self, pszName, pszValue, pszDomain='') CPLErr
osgeo.gdal.MultipartUploadAbort(pszFilename, pszUploadId, options=None) bool
osgeo.gdal.MultipartUploadAddPart(pszFilename, pszUploadId, nPartNumber, nFileOffset, nDataLength, options=None) retStringAndCPLFree *
osgeo.gdal.MultipartUploadEnd(pszFilename, pszUploadId, partIds, nTotalSize, options=None) bool
osgeo.gdal.MultipartUploadGetCapabilities(pszFilename)
osgeo.gdal.MultipartUploadStart(pszFilename, options=None) retStringAndCPLFree *
osgeo.gdal.NetworkStatsGetAsSerializedJSON(options=None) retStringAndCPLFree *
osgeo.gdal.NetworkStatsReset()
osgeo.gdal.PackedDMSToDec(dfPacked) double
osgeo.gdal.ParseCommandLine(path) char **
osgeo.gdal.ParseXMLString(pszXMLString) CPLXMLNode *
osgeo.gdal.PopFinderLocation()
osgeo.gdal.PushFinderLocation(path)
osgeo.gdal.RGBFile2PCTFile(src_filename, dst_filename)
class osgeo.gdal.RawBlockInfo(*args)

Bases: object

Proxy of C++ GDALMDArrayRawBlockInfo class.

GetFilename(self) char const *
GetInfo(self) char **
GetInlineData(self)
GetOffset(self) GUIntBig
GetSize(self) GUIntBig
osgeo.gdal.ReprojectImage(src_ds, dst_ds, src_wkt=None, dst_wkt=None, eResampleAlg=GRA_NearestNeighbour, WarpMemoryLimit=0.0, maxerror=0.0, callback=0, callback_data=None, options=None) CPLErr

Reproject image.

See GDALReprojectImage().

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

osgeo.gdal.SerializeXMLTree(xmlnode) retStringAndCPLFree *
class osgeo.gdal.StatBuf(*args)

Bases: object

Proxy of C++ StatBuf class.

IsDirectory(self) int
property mode
property mtime
property size
class osgeo.gdal.Statistics(*args)

Bases: object

Proxy of C++ Statistics class.

property max
property min
property std_dev
property valid_count
class osgeo.gdal.SubdatasetInfo(*args, **kwargs)

Bases: object

Proxy of C++ GDALSubdatasetInfoShadow class.

GetPathComponent(self) retStringAndCPLFree *
GetSubdatasetComponent(self) retStringAndCPLFree *
ModifyPathComponent(self, pszNewFileName) retStringAndCPLFree *
osgeo.gdal.SuggestedWarpOutputFromOptions(src, options) SuggestedWarpOutputRes
osgeo.gdal.SuggestedWarpOutputFromTransformer(src, transformer) SuggestedWarpOutputRes
class osgeo.gdal.SuggestedWarpOutputRes(*args, **kwargs)

Bases: object

Proxy of C++ SuggestedWarpOutputRes class.

GetGeotransform(self)
property geotransform

double[6]

Type:

geotransform

property height
property width
property xmax
property xmin
property ymax
property ymin
osgeo.gdal.TermProgress_nocb(dfProgress, pszMessage=None, pData=None) int
osgeo.gdal.Transformer(src, dst, options) GDALTransformerInfoShadow
osgeo.gdal.VSICurlClearCache()
osgeo.gdal.VSICurlPartialClearCache(path)
osgeo.gdal.VSIErrorReset()
osgeo.gdal.VSIFClearErrL(fp)
osgeo.gdal.VSIFCloseL(fp) VSI_RETVAL
osgeo.gdal.VSIFEofL(fp) int
osgeo.gdal.VSIFErrorL(fp) int
osgeo.gdal.VSIFFlushL(fp) int
osgeo.gdal.VSIFGetRangeStatusL(fp, offset, length) int
osgeo.gdal.VSIFOpenExL(path, pszMode, bSetError=FALSE, options=None) VSILFILE
osgeo.gdal.VSIFOpenL(path, pszMode) VSILFILE
osgeo.gdal.VSIFReadL(nMembSize, nMembCount, fp) unsigned int
osgeo.gdal.VSIFSeekL(fp, offset, whence) int
osgeo.gdal.VSIFTellL(fp) GIntBig
osgeo.gdal.VSIFTruncateL(fp, length) int
osgeo.gdal.VSIFWriteL(nLen, size, memb, fp) int
osgeo.gdal.VSIGetLastErrorMsg() char const *
osgeo.gdal.VSIGetLastErrorNo() int
osgeo.gdal.VSIGetMemFileBuffer_unsafe(utf8_string)
class osgeo.gdal.VSILFILE(*args, **kwargs)

Bases: object

Proxy of C++ VSILFILE class.

osgeo.gdal.VSIStatL(path, nFlags=0) int
osgeo.gdal.VSISupportsSparseFiles(path) int
class osgeo.gdal.VirtualMem(*args, **kwargs)

Bases: object

Proxy of C++ CPLVirtualMemShadow class.

GetAddr(self)
Pin(self, start_offset=0, nsize=0, 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