GDAL.ArrowArrayStreamType

Data type for a Arrow C stream Include ogr\_recordbatch.h to get the definition

GDAL.CPLSharedFileInfoType
CPLSharedFileInfo

Information on a shared file

FieldNote
fpFile pointer
nRefCountReference counter
bLargeWhether fp must be interpreted as VSIFILE*
pszFilenameFilename
pszAccessAccess mode
GDAL.CPLVirtualMemAccessModeType
CPLVirtualMemAccessMode

Access mode of a virtual memory mapping.

EnumeratorNote
VIRTUALMEM_READONLYThe mapping is meant at being read-only, but writes will not be prevented. Note that any content written will be lost.
VIRTUALMEM_READONLY_ENFORCEDThe mapping is meant at being read-only, and this will be enforced through the operating system page protection mechanism.
VIRTUALMEM_READWRITEThe mapping is meant at being read-write, and modified pages can be saved thanks to the pfnUnCachePage callback
GDAL.CPLVirtualMemCachePageCbkType

Callback triggered when a still unmapped page of virtual memory is accessed. The callback has the responsibility of filling the page with relevant values

Parameters

  • ctxt: virtual memory handle.
  • nOffset: offset of the page in the memory mapping.
  • pPageToFill: address of the page to fill. Note that the address might be a temporary location, and not at CPLVirtualMemGetAddr() + nOffset.
  • nToFill: number of bytes of the page.
  • pUserData: user data that was passed to CPLVirtualMemNew().
GDAL.CPLVirtualMemUnCachePageCbkType

Callback triggered when a dirty mapped page is going to be freed. (saturation of cache, or termination of the virtual memory mapping).

Parameters

  • ctxt: virtual memory handle.
  • nOffset: offset of the page in the memory mapping.
  • pPageToBeEvicted: address of the page that will be flushed. Note that the address might be a temporary location, and not at CPLVirtualMemGetAddr() + nOffset.
  • nToBeEvicted: number of bytes of the page.
  • pUserData: user data that was passed to CPLVirtualMemNew().
GDAL.CPLXMLNodeType
CPLXMLNode

Document node structure.

This C structure is used to hold a single text fragment representing a component of the document when parsed. It should be allocated with the appropriate CPL function, and freed with CPLDestroyXMLNode(). The structure contents should not normally be altered by application code, but may be freely examined by application code.

Using the psChild and psNext pointers, a hierarchical tree structure for a document can be represented as a tree of CPLXMLNode structures.

FieldNote
eTypeNode type One of CXT_Element, CXT_Text, CXT_Attribute, CXT_Comment, or CXT_Literal.
pszValueNode value For CXT_Element this is the name of the element, without the angle brackets. Note there is a single CXT_Element even when the document contains a start and end element tag. The node represents the pair. All text or other elements between the start and end tag will appear as children nodes of this CXT_Element node. For CXT_Attribute the pszValue is the attribute name. The value of the attribute will be a CXT_Text child. For CXT_Text this is the text itself (value of an attribute, or a text fragment between an element start and end tags. For CXT_Literal it is all the literal text. Currently this is just used for !DOCTYPE lines, and the value would be the entire line. For CXT_Comment the value is all the literal text within the comment, but not including the comment start/end indicators ("<–" and "–>").
psNextNext sibling. Pointer to next sibling, that is the next node appearing after this one that has the same parent as this node. NULL if this node is the last child of the parent element.
psChildChild node. Pointer to first child node, if any. Only CXT_Element and CXT_Attribute nodes should have children. For CXT_Attribute it should be a single CXT_Text value node, while CXT_Element can have any kind of child. The full list of children for a node are identified by walking the psNext's starting with the psChild node.
GDAL.CPLXMLNodeTypeType
CPLXMLNodeType

XML node type

EnumeratorNote
CXT_ElementNode is an element
CXT_TextNode is a raw text value
CXT_AttributeNode is attribute
CXT_CommentNode is an XML comment.
CXT_LiteralNode is a special literal
GDAL.CSLConstListType

Type of a constant null-terminated list of nul terminated strings. Seen as char** from C and const char* const* from C++

GDAL.GBoolType

Type for boolean values (alias to int)

GDAL.GDALAccessType
GDALAccess

Flag indicating read/write, or read-only access to data.

EnumeratorNote
GA_ReadOnlyRead only (no update) access
GA_UpdateRead/write access.
GDAL.GDALColorEntryType
GDALColorEntry

Color tuple

FieldNote
c1gray, red, cyan or hue
c2green, magenta, or lightness
c3blue, yellow, or saturation
c4alpha or blackband
GDAL.GDALColorInterpType
GDALColorInterp

Types of color interpretation for raster bands.

EnumeratorNote
GCI_UndefinedUndefined
GCI_GrayIndexGreyscale
GCI_PaletteIndexPaletted (see associated color table)
GCI_RedBandRed band of RGBA image
GCI_GreenBandGreen band of RGBA image
GCI_BlueBandBlue band of RGBA image
GCI_AlphaBandAlpha (0=transparent, 255=opaque)
GCI_HueBandHue band of HLS image
GCI_SaturationBandSaturation band of HLS image
GCI_LightnessBandLightness band of HLS image
GCI_CyanBandCyan band of CMYK image
GCI_MagentaBandMagenta band of CMYK image
GCI_YellowBandYellow band of CMYK image
GCI_BlackBandBlack band of CMYK image
GCI_YCbCr_YBandY Luminance
GCI_YCbCr_CbBandCb Chroma
GCI_YCbCr_CrBandCr Chroma
GCI_MaxMax current value (equals to GCI_YCbCr_CrBand currently)
GDAL.GDALDataTypeType
GDALDataType

Pixel data types

EnumeratorNote
GDT_UnknownUnknown or unspecified type
GDT_ByteEight bit unsigned integer
GDT_Int88-bit signed integer (GDAL >= 3.7)
GDT_UInt16Sixteen bit unsigned integer
GDT_Int16Sixteen bit signed integer
GDT_UInt32Thirty two bit unsigned integer
GDT_Int32Thirty two bit signed integer
GDT_UInt6464 bit unsigned integer (GDAL >= 3.5)
GDT_Int6464 bit signed integer (GDAL >= 3.5)
GDT_Float32Thirty two bit floating point
GDT_Float64Sixty four bit floating point
GDT_CInt16Complex Int16
GDT_CInt32Complex Int32
GDT_CFloat32Complex Float32
GDT_CFloat64Complex Float64
GDT_TypeCount
GDAL.GDALDatasetHType

Opaque type used for the C bindings of the C++ GDALDataset class

GDAL.GDALDriverHType

Opaque type used for the C bindings of the C++ GDALDriver class

GDAL.GDALExtendedDataTypeClassType
GDALExtendedDataTypeClass

Enumeration giving the class of a GDALExtendedDataType.

\since GDAL 3.1

EnumeratorNote
GEDTC_NUMERICNumeric value. Based on GDALDataType enumeration
GEDTC_STRINGString value.
GEDTC_COMPOUNDCompound data type.
GDAL.GDALExtendedDataTypeSubTypeType
GDALExtendedDataTypeSubType

Enumeration giving the subtype of a GDALExtendedDataType.

\since GDAL 3.4

EnumeratorNote
GEDTST_NONENone.
GEDTST_JSONJSon. Only applies to GEDTC_STRING
GDAL.GDALGridAlgorithmType
GDALGridAlgorithm

Gridding Algorithms

EnumeratorNote
GGA_InverseDistanceToAPowerInverse distance to a power
GGA_MovingAverageMoving Average
GGA_NearestNeighborNearest Neighbor
GGA_MetricMinimumMinimum Value (Data Metric)
GGA_MetricMaximumMaximum Value (Data Metric)
GGA_MetricRangeData Range (Data Metric)
GGA_MetricCountNumber of Points (Data Metric)
GGA_MetricAverageDistanceAverage Distance (Data Metric)
GGA_MetricAverageDistancePtsAverage Distance Between Data Points (Data Metric)
GGA_LinearLinear interpolation (from Delaunay triangulation. Since GDAL 2.1
GGA_InverseDistanceToAPowerNearestNeighborInverse distance to a power with nearest neighbor search for max points
GDAL.GDALGridDataMetricsOptionsType
GDALGridDataMetricsOptions

Data metrics method control options

FieldNote
nSizeOfStructureAdded in GDAL 3.6 to detect potential ABI issues. Should be set to sizeof(GDALGridDataMetricsOptions)
dfRadius1The first radius (X axis if rotation angle is 0) of search ellipse.
dfRadius2The second radius (Y axis if rotation angle is 0) of search ellipse.
dfAngleAngle of ellipse rotation in degrees. Ellipse rotated counter clockwise.
nMinPointsMinimum number of data points to average. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
dfNoDataValueNo data marker to fill empty points.
nMaxPointsPerQuadrantMaximum number of data points to use for each of the 4 quadrants. Do not search for more points than this number.
nMinPointsPerQuadrantMinimum number of data points to use for each of the 4 quadrants. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
GDAL.GDALGridInverseDistanceToAPowerNearestNeighborOptionsType
GDALGridInverseDistanceToAPowerNearestNeighborOptions

Inverse distance to a power, with nearest neighbour search, control options

FieldNote
nSizeOfStructureAdded in GDAL 3.6 to detect potential ABI issues. Should be set to sizeof(GDALGridInverseDistanceToAPowerNearestNeighborOptions)
dfPowerWeighting power.
dfRadiusThe radius of search circle.
dfSmoothingSmoothing parameter.
nMaxPointsMaximum number of data points to use. Do not search for more points than this number.
nMinPointsMinimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
dfNoDataValueNo data marker to fill empty points.
nMaxPointsPerQuadrantMaximum number of data points to use for each of the 4 quadrants. Do not search for more points than this number.
nMinPointsPerQuadrantMinimum number of data points to use for each of the 4 quadrants. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
GDAL.GDALGridInverseDistanceToAPowerOptionsType
GDALGridInverseDistanceToAPowerOptions

Inverse distance to a power method control options

FieldNote
nSizeOfStructureAdded in GDAL 3.6 to detect potential ABI issues. Should be set to sizeof(GDALGridInverseDistanceToAPowerOptions)
dfPowerWeighting power.
dfSmoothingSmoothing parameter.
dfAnisotropyRatioReserved for future use.
dfAnisotropyAngle
dfRadius1The first radius (X axis if rotation angle is 0) of search ellipse.
dfRadius2The second radius (Y axis if rotation angle is 0) of search ellipse.
dfAngleAngle of ellipse rotation in degrees. Ellipse rotated counter clockwise.
nMaxPointsMaximum number of data points to use. Do not search for more points than this number.
nMinPointsMinimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
dfNoDataValueNo data marker to fill empty points.
GDAL.GDALGridLinearOptionsType
GDALGridLinearOptions

Linear method control options

FieldNote
nSizeOfStructureAdded in GDAL 3.6 to detect potential ABI issues. Should be set to sizeof(GDALGridLinearOptions)
dfRadiusIn case the point to be interpolated does not fit into a triangle of the Delaunay triangulation, use that maximum distance to search a nearest neighbour, or use nodata otherwise. If set to -1, the search distance is infinite. If set to 0, nodata value will be always used.
dfNoDataValueNo data marker to fill empty points.
GDAL.GDALGridMovingAverageOptionsType
GDALGridMovingAverageOptions

Moving average method control options

FieldNote
nSizeOfStructureAdded in GDAL 3.6 to detect potential ABI issues. Should be set to sizeof(GDALGridMovingAverageOptions)
dfRadius1The first radius (X axis if rotation angle is 0) of search ellipse.
dfRadius2The second radius (Y axis if rotation angle is 0) of search ellipse.
dfAngleAngle of ellipse rotation in degrees. Ellipse rotated counter clockwise.
nMaxPointsMaximum number of data points to use. Do not search for more points than this number.
nMinPointsMinimum number of data points to average. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
dfNoDataValueNo data marker to fill empty points.
nMaxPointsPerQuadrantMaximum number of data points to use for each of the 4 quadrants. Do not search for more points than this number.
nMinPointsPerQuadrantMinimum number of data points to use for each of the 4 quadrants. If less amount of points found the grid node considered empty and will be filled with NODATA marker.
GDAL.GDALGridNearestNeighborOptionsType
GDALGridNearestNeighborOptions

Nearest neighbor method control options

FieldNote
nSizeOfStructureAdded in GDAL 3.6 to detect potential ABI issues. Should be set to sizeof(GDALGridNearestNeighborOptions)
dfRadius1The first radius (X axis if rotation angle is 0) of search ellipse.
dfRadius2The second radius (Y axis if rotation angle is 0) of search ellipse.
dfAngleAngle of ellipse rotation in degrees. Ellipse rotated counter clockwise.
dfNoDataValueNo data marker to fill empty points.
GDAL.GDALPaletteInterpType
GDALPaletteInterp

Types of color interpretations for a GDALColorTable.

EnumeratorNote
GPI_GrayGrayscale (in GDALColorEntry.c1)
GPI_RGBRed, Green, Blue and Alpha in (in c1, c2, c3 and c4)
GPI_CMYKCyan, Magenta, Yellow and Black (in c1, c2, c3 and c4)
GPI_HLSHue, Lightness and Saturation (in c1, c2, and c3)
GDAL.GDALRATFieldTypeType
GDALRATFieldType

Field type of raster attribute table

EnumeratorNote
GFT_IntegerInteger field
GFT_RealFloating point (double) field
GFT_StringString field
GDAL.GDALRATFieldUsageType
GDALRATFieldUsage

Field usage of raster attribute table

EnumeratorNote
GFU_GenericGeneral purpose field.
GFU_PixelCountHistogram pixel count
GFU_NameClass name
GFU_MinClass range minimum
GFU_MaxClass range maximum
GFU_MinMaxClass value (min=max)
GFU_RedRed class color (0-255)
GFU_GreenGreen class color (0-255)
GFU_BlueBlue class color (0-255)
GFU_AlphaAlpha (0=transparent,255=opaque)
GFU_RedMinColor Range Red Minimum
GFU_GreenMinColor Range Green Minimum
GFU_BlueMinColor Range Blue Minimum
GFU_AlphaMinColor Range Alpha Minimum
GFU_RedMaxColor Range Red Maximum
GFU_GreenMaxColor Range Green Maximum
GFU_BlueMaxColor Range Blue Maximum
GFU_AlphaMaxColor Range Alpha Maximum
GFU_MaxCountMaximum GFU value (equals to GFU_AlphaMax+1 currently)
GDAL.GDALRATTableTypeType
GDALRATTableType

RAT table type (thematic or athematic)

\since GDAL 2.4

EnumeratorNote
GRTT_THEMATICThematic table type
GRTT_ATHEMATICAthematic table type
GDAL.GDALRIOResampleAlgType
GDALRIOResampleAlg

RasterIO() resampling method.

\since GDAL 2.0

EnumeratorNote
GRIORA_NearestNeighbourNearest neighbour
GRIORA_BilinearBilinear (2x2 kernel)
GRIORA_CubicCubic Convolution Approximation (4x4 kernel)
GRIORA_CubicSplineCubic B-Spline Approximation (4x4 kernel)
GRIORA_LanczosLanczos windowed sinc interpolation (6x6 kernel)
GRIORA_AverageAverage
GRIORA_ModeMode (selects the value which appears most often of all the sampled points)
GRIORA_GaussGauss blurring
GRIORA_RESERVED_STARTDoxygen_Suppress
GRIORA_RESERVED_END
GRIORA_RMS RMS: Root Mean Square / Quadratic Mean. For complex numbers, applies on the real and imaginary part independently.
GRIORA_LASTDoxygen_Suppress
GDAL.GDALRPCInfoV1Type
GDALRPCInfoV1
FieldNote
dfLINE_OFFLine offset
dfSAMP_OFFSample/Pixel offset
dfLAT_OFFLatitude offset
dfLONG_OFFLongitude offset
dfHEIGHT_OFFHeight offset
dfLINE_SCALELine scale
dfSAMP_SCALESample/Pixel scale
dfLAT_SCALELatitude scale
dfLONG_SCALELongitude scale
dfHEIGHT_SCALEHeight scale
adfLINE_NUM_COEFFLine Numerator Coefficients
adfLINE_DEN_COEFFLine Denominator Coefficients
adfSAMP_NUM_COEFFSample/Pixel Numerator Coefficients
adfSAMP_DEN_COEFFSample/Pixel Denominator Coefficients
dfMIN_LONGMinimum longitude
dfMIN_LATMinimum latitude
dfMAX_LONGMaximum longitude
dfMAX_LATMaximum latitude
GDAL.GDALRPCInfoV2Type
GDALRPCInfoV2

Structure to store Rational Polynomial Coefficients / Rigorous Projection Model. See http://geotiff.maptools.org/rpc_prop.html

FieldNote
dfLINE_OFFLine offset
dfSAMP_OFFSample/Pixel offset
dfLAT_OFFLatitude offset
dfLONG_OFFLongitude offset
dfHEIGHT_OFFHeight offset
dfLINE_SCALELine scale
dfSAMP_SCALESample/Pixel scale
dfLAT_SCALELatitude scale
dfLONG_SCALELongitude scale
dfHEIGHT_SCALEHeight scale
adfLINE_NUM_COEFFLine Numerator Coefficients
adfLINE_DEN_COEFFLine Denominator Coefficients
adfSAMP_NUM_COEFFSample/Pixel Numerator Coefficients
adfSAMP_DEN_COEFFSample/Pixel Denominator Coefficients
dfMIN_LONGMinimum longitude
dfMIN_LATMinimum latitude
dfMAX_LONGMaximum longitude
dfMAX_LATMaximum latitude
dfERR_BIASBias error
dfERR_RANDRandom error
GDAL.GDALRWFlagType
GDALRWFlag

Read/Write flag for RasterIO() method

EnumeratorNote
GF_ReadRead data
GF_WriteWrite data
GDAL.GDALRasterIOExtraArgType
GDALRasterIOExtraArg

Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_ARG

\since GDAL 2.0

FieldNote
nVersionVersion of structure (to allow future extensions of the structure)
eResampleAlgResampling algorithm
pfnProgressProgress callback
pProgressDataProgress callback user data
bFloatingPointWindowValidityIndicate if dfXOff, dfYOff, dfXSize and dfYSize are set. Mostly reserved from the VRT driver to communicate a more precise source window. Must be such that dfXOff - nXOff < 1.0 and dfYOff - nYOff < 1.0 and nXSize - dfXSize < 1.0 and nYSize - dfYSize < 1.0
dfXOffPixel offset to the top left corner. Only valid if bFloatingPointWindowValidity = TRUE
dfYOffLine offset to the top left corner. Only valid if bFloatingPointWindowValidity = TRUE
dfXSizeWidth in pixels of the area of interest. Only valid if bFloatingPointWindowValidity = TRUE
dfYSizeHeight in pixels of the area of interest. Only valid if bFloatingPointWindowValidity = TRUE
GDAL.GDALRelationshipCardinalityType
GDALRelationshipCardinality

Cardinality of relationship.

\since GDAL 3.6

EnumeratorNote
GRC_ONE_TO_ONEOne-to-one
GRC_ONE_TO_MANYOne-to-many
GRC_MANY_TO_ONEMany-to-one
GRC_MANY_TO_MANYMany-to-many
GDAL.GDALRelationshipHType

Opaque type used for the C bindings of the C++ GDALRelationship class

\since GDAL 3.6

GDAL.GDALRelationshipTypeType
GDALRelationshipType

Type of relationship.

\since GDAL 3.6

EnumeratorNote
GRT_COMPOSITEComposite relationship
GRT_ASSOCIATIONAssociation relationship
GRT_AGGREGATIONAggregation relationship
GDAL.GDALResampleAlgType
GDALResampleAlg

Warp Resampling Algorithm

EnumeratorNote
GRA_NearestNeighbourNearest neighbour (select on one input pixel)
GRA_BilinearBilinear (2x2 kernel)
GRA_CubicCubic Convolution Approximation (4x4 kernel)
GRA_CubicSplineCubic B-Spline Approximation (4x4 kernel)
GRA_LanczosLanczos windowed sinc interpolation (6x6 kernel)
GRA_AverageAverage (computes the weighted average of all non-NODATA contributing pixels)
GRA_ModeMode (selects the value which appears most often of all the sampled points)
GRA_MaxMax (selects maximum of all non-NODATA contributing pixels)
GRA_MinMin (selects minimum of all non-NODATA contributing pixels)
GRA_MedMed (selects median of all non-NODATA contributing pixels)
GRA_Q1Q1 (selects first quartile of all non-NODATA contributing pixels)
GRA_Q3Q3 (selects third quartile of all non-NODATA contributing pixels)
GRA_SumSum (weighed sum of all non-NODATA contributing pixels). Added in GDAL 3.1
GRA_RMSRMS (weighted root mean square (quadratic mean) of all non-NODATA contributing pixels)
GRA_LAST_VALUEDoxygen_Suppress
GDAL.GDALTileOrganizationType
GDALTileOrganization

! Enumeration to describe the tile organization

EnumeratorNote
GTO_TIPTile Interleaved by Pixel: tile (0,0) with internal band interleaved by pixel organization, tile (1, 0), ...
GTO_BITBand Interleaved by Tile : tile (0,0) of first band, tile (0,0) of second band, ... tile (1,0) of first band, tile (1,0) of second band, ...
GTO_BSQBand SeQuential : all the tiles of first band, all the tiles of following band...
GDAL.GDALTriBarycentricCoefficientsType
GDALTriBarycentricCoefficients

Triangle barycentric coefficients.

Conversion from cartesian (x,y) to barycentric (l1,l2,l3) with : l1 = dfMul1X * (x - dfCxtX) + dfMul1Y * (y - dfCstY) l2 = dfMul2X * (x - dfCxtX) + dfMul2Y * (y - dfCstY) l3 = 1 - l1 - l2

FieldNote
dfMul1XdfMul1X
dfMul1YdfMul1Y
dfMul2XdfMul2X
dfMul2YdfMul2Y
dfCstXdfCstX
dfCstYdfCstY
GDAL.GDALTriFacetType
GDALTriFacet

Triangle fact

FieldNote
anVertexIdxindex to the padfX/padfY arrays
anNeighborIdxindex to GDALDelaunayTriangulation.pasFacets, or -1
GDAL.GDALTriangulationType
GDALTriangulation

Triangulation structure

FieldNote
nFacetsnumber of facets
pasFacetsarray of nFacets facets
pasFacetCoefficientsarra of nFacets barycentric coefficients
GDAL.GDALWarpOptionsType
GDALWarpOptions

Warp control options for use with GDALWarpOperation::Initialize()

FieldNote
dfWarpMemoryLimitIn bytes, 0.0 for internal default
eResampleAlgResampling algorithm to use
eWorkingDataTypedata type to use during warp operation, GDT_Unknown lets the algorithm select the type
hSrcDSSource image dataset.
hDstDSDestination image dataset - may be NULL if only using GDALWarpOperation::WarpRegionToBuffer().
nBandCountNumber of bands to process, may be 0 to select all bands.
panSrcBandsThe band numbers for the source bands to process (1 based)
panDstBandsThe band numbers for the destination bands to process (1 based)
nSrcAlphaBandThe source band so use as an alpha (transparency) value, 0=disabled
nDstAlphaBandThe dest. band so use as an alpha (transparency) value, 0=disabled
padfSrcNoDataRealThe "nodata" value real component for each input band, if NULL there isn't one
padfSrcNoDataImagThe "nodata" value imaginary component - may be NULL even if real component is provided. This value is not used to flag invalid values. Only the real component is used.
padfDstNoDataRealThe "nodata" value real component for each output band, if NULL there isn't one
padfDstNoDataImagThe "nodata" value imaginary component - may be NULL even if real component is provided. Note that warp operations only use real component for flagging invalid data.
pfnProgressGDALProgressFunc() compatible progress reporting function, or NULL if there isn't one.
pProgressArgCallback argument to be passed to pfnProgress.
pfnTransformerType of spatial point transformer function
pTransformerArgHandle to image transformer setup structure
papfnSrcPerBandValidityMaskFuncUnused. Must be NULL
papSrcPerBandValidityMaskFuncArg
pfnSrcValidityMaskFunc
pSrcValidityMaskFuncArg
pfnSrcDensityMaskFunc
pSrcDensityMaskFuncArg
pfnDstDensityMaskFunc
pDstDensityMaskFuncArg
pfnDstValidityMaskFunc
pDstValidityMaskFuncArg
pfnPreWarpChunkProcessor
pPreWarpProcessorArg
pfnPostWarpChunkProcessor
pPostWarpProcessorArg
hCutlineOptional OGRPolygonH for a masking cutline.
dfCutlineBlendDistOptional blending distance to apply across cutline in pixels, default is zero.
GDAL.GDAL_GCPType
GDAL_GCP

Ground Control Point

FieldNote
pszIdUnique identifier, often numeric
pszInfoInformational message or ""
dfGCPPixelPixel (x) location of GCP on raster
dfGCPLineLine (y) location of GCP on raster
dfGCPXX position of GCP in georeferenced space
dfGCPYY position of GCP in georeferenced space
dfGCPZElevation of GCP, or zero if not known
GDAL.GIntBigType

Large signed integer type (generally 64-bit integer type). Use GInt64 when exactly 64 bit is needed

GDAL.GPtrDiff_tType

Integer type large enough to hold the difference between 2 addresses

GDAL.GSpacingType

Type to express pixel, line or band spacing. Signed 64 bit integer

GDAL.GUIntBigType

Large unsigned integer type (generally 64-bit unsigned integer type). Use GUInt64 when exactly 64 bit is needed

GDAL.GWKAverageOrModeAlgType
GWKAverageOrModeAlg

GWKAverageOrMode Algorithm

EnumeratorNote
GWKAOM_AverageAverage
GWKAOM_FmodeMode
GWKAOM_ImodeMode of GDT_Byte, GDT_UInt16, or GDT_Int16
GWKAOM_MaxMaximum
GWKAOM_MinMinimum
GWKAOM_QuantQuantile
GWKAOM_SumSum
GWKAOM_RMSRMS
GDAL.OGRAxisOrientationType
OGRAxisOrientation

Axis orientations (corresponds to CS_AxisOrientationEnum).

EnumeratorNote
OAO_OtherOther
OAO_NorthNorth
OAO_SouthSouth
OAO_EastEast
OAO_WestWest
OAO_UpUp (to space)
OAO_DownDown (to Earth center)
GDAL.OGRCodedValueType
OGRCodedValue

Associates a code and a value

\since GDAL 3.3

FieldNote
pszCodeCode. Content should be of the type of the OGRFieldDomain
pszValueValue. Might be NULL
GDAL.OGRFieldType
OGRField

OGRFeature field attribute value union.

GDAL.OGRFieldDomainMergePolicyType
OGRFieldDomainMergePolicy

Merge policy for field domains.

When a feature is built by merging two features, defines how the value of attributes following the domain are computed.

\since GDAL 3.3

EnumeratorNote
OFDMP_DEFAULT_VALUEDefault value
OFDMP_SUMSum
OFDMP_GEOMETRY_WEIGHTEDNew values are computed as the weighted average of the source values.
GDAL.OGRFieldDomainSplitPolicyType
OGRFieldDomainSplitPolicy

Split policy for field domains.

When a feature is split in two, defines how the value of attributes following the domain are computed.

\since GDAL 3.3

EnumeratorNote
OFDSP_DEFAULT_VALUEDefault value
OFDSP_DUPLICATEDuplicate
OFDSP_GEOMETRY_RATIONew values are computed by the ratio of their area/length compared to the area/length of the original feature
GDAL.OGRFieldDomainTypeType
OGRFieldDomainType

Type of field domain.

\since GDAL 3.3

EnumeratorNote
OFDT_CODEDCoded
OFDT_RANGERange (min/max)
OFDT_GLOBGlob (used by GeoPackage)
GDAL.OGRFieldSubTypeType
OGRFieldSubType

List of field subtypes. A subtype represents a hint, a restriction of the main type, that is not strictly necessary to consult. This list is likely to be extended in the future ... avoid coding applications based on the assumption that all field types can be known. Most subtypes only make sense for a restricted set of main types.

\since GDAL 2.0

EnumeratorNote
OFSTNoneNo subtype. This is the default value
OFSTBooleanBoolean integer. Only valid for OFTInteger and OFTIntegerList.
OFSTInt16Signed 16-bit integer. Only valid for OFTInteger and OFTIntegerList.
OFSTFloat32Single precision (32 bit) floating point. Only valid for OFTReal and OFTRealList.
OFSTJSONJSON content. Only valid for OFTString. \since GDAL 2.4
OFSTUUIDUUID string representation. Only valid for OFTString. \since GDAL 3.3
OFSTMaxSubType
GDAL.OGRFieldTypeType
OGRFieldType

List of feature field types. This list is likely to be extended in the future ... avoid coding applications based on the assumption that all field types can be known.

EnumeratorNote
OFTIntegerSimple 32bit integer
OFTIntegerListList of 32bit integers
OFTRealDouble Precision floating point
OFTRealListList of doubles
OFTStringString of ASCII chars
OFTStringListArray of strings
OFTWideStringdeprecated
OFTWideStringList
OFTBinaryRaw Binary data
OFTDateDate
OFTTimeTime
OFTDateTimeDate and Time
OFTInteger64Single 64bit integer
OFTInteger64ListList of 64bit integers
OFTMaxType
GDAL.OGRwkbByteOrderType
OGRwkbByteOrder

Enumeration to describe byte order

EnumeratorNote
wkbXDRMSB/Sun/Motorola: Most Significant Byte First
wkbNDRLSB/Intel/Vax: Least Significant Byte First
GDAL.OGRwkbGeometryTypeType
OGRwkbGeometryType

List of well known binary geometry types. These are used within the BLOBs but are also returned from OGRGeometry::getGeometryType() to identify the type of a geometry object.

EnumeratorNote
wkbUnknownunknown type, non-standard
wkbPoint0-dimensional geometric object, standard WKB
wkbLineString1-dimensional geometric object with linear interpolation between Points, standard WKB
wkbPolygonplanar 2-dimensional geometric object defined by 1 exterior boundary and 0 or more interior boundaries, standard WKB
wkbMultiPointGeometryCollection of Points, standard WKB
wkbMultiPolygonGeometryCollection of Polygons, standard WKB
wkbGeometryCollectiongeometric object that is a collection of 1 or more geometric objects, standard WKB
wkbCircularStringone or more circular arc segments connected end to end, ISO SQL/MM Part 3. GDAL >= 2.0
wkbCompoundCurvesequence of contiguous curves, ISO SQL/MM Part 3. GDAL >= 2.0
wkbCurvePolygonplanar surface, defined by 1 exterior boundary and zero or more interior boundaries, that are curves. ISO SQL/MM Part 3. GDAL >= 2.0
wkbMultiCurveGeometryCollection of Curves, ISO SQL/MM Part 3. GDAL >= 2.0
wkbMultiSurfaceGeometryCollection of Surfaces, ISO SQL/MM Part 3. GDAL >= 2.0
wkbTINa PolyhedralSurface consisting only of Triangle patches ISO SQL/MM Part 3. GDAL >= 2.3
wkbTrianglea Triangle. ISO SQL/MM Part 3. GDAL >= 2.3
wkbNonenon-standard, for pure attribute records
wkbLinearRingnon-standard, just for createGeometry()
wkbCircularStringZwkbCircularString with Z component. ISO SQL/MM Part 3. GDAL >= 2.0
wkbCompoundCurveZwkbCompoundCurve with Z component. ISO SQL/MM Part 3. GDAL >= 2.0
wkbCurvePolygonZwkbCurvePolygon with Z component. ISO SQL/MM Part 3. GDAL >= 2.0
wkbMultiCurveZwkbMultiCurve with Z component. ISO SQL/MM Part 3. GDAL >= 2.0
wkbMultiSurfaceZwkbMultiSurface with Z component. ISO SQL/MM Part 3. GDAL >= 2.0
wkbCurveZwkbCurve with Z component. ISO SQL/MM Part 3. GDAL >= 2.1
wkbSurfaceZwkbSurface with Z component. ISO SQL/MM Part 3. GDAL >= 2.1
wkbPolyhedralSurfaceZISO SQL/MM Part 3. GDAL >= 2.3
wkbTINZ
wkbTriangleZ
wkbPointMISO SQL/MM Part 3. GDAL >= 2.1
wkbLineStringM
wkbPolygonM
wkbMultiPointM
wkbMultiLineStringM
wkbMultiPolygonM
wkbGeometryCollectionM
wkbCircularStringM
wkbCompoundCurveM
wkbCurvePolygonM
wkbMultiCurveM
wkbMultiSurfaceM
wkbCurveM
wkbSurfaceM
wkbPolyhedralSurfaceMISO SQL/MM Part 3. GDAL >= 2.3
wkbTINM
wkbTriangleM
wkbPointZMISO SQL/MM Part 3. GDAL >= 2.1
wkbLineStringZM
wkbPolygonZM
wkbMultiPointZM
wkbMultiLineStringZM
wkbMultiPolygonZM
wkbGeometryCollectionZM
wkbCircularStringZM
wkbCompoundCurveZM
wkbCurvePolygonZM
wkbMultiCurveZM
wkbMultiSurfaceZM
wkbCurveZM
wkbSurfaceZM
wkbPolyhedralSurfaceZMISO SQL/MM Part 3. GDAL >= 2.3
wkbTINZM
wkbTriangleZM
wkbPoint25D2.5D extension as per 99-402
wkbLineString25D
wkbPolygon25D
wkbMultiPoint25D
wkbMultiLineString25D
wkbMultiPolygon25D
wkbGeometryCollection25D
GDAL.OGRwkbVariantType
OGRwkbVariant

Output variants of WKB we support.

99-402 was a short-lived extension to SFSQL 1.1 that used a high-bit flag to indicate the presence of Z coordinates in a WKB geometry.

SQL/MM Part 3 and SFSQL 1.2 use offsets of 1000 (Z), 2000 (M) and 3000 (ZM) to indicate the present of higher dimensional coordinates in a WKB geometry. Reference: <a href="https://portal.opengeospatial.org/files/?artifactid=320243"> 09-009\Committee_Draft_ISOIEC_CD_13249-3_SQLMM_Spatial.pdf</a>, ISO/IEC JTC 1/SC 32 N 1820, ISO/IEC CD 13249-3:201x(E), Date: 2009-01-16. The codes are also found in §8.2.3 of <a href="http://portal.opengeospatial.org/files/?artifact_id=25355"> OGC 06-103r4 "OpenGIS® Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture", v1.2.1</a>

EnumeratorNote
wkbVariantOldOgcOld-style 99-402 extended dimension (Z) WKB types
wkbVariantIsoSFSQL 1.2 and ISO SQL/MM Part 3 extended dimension (Z&M) WKB types
wkbVariantPostGIS1PostGIS 1.X has different codes for CurvePolygon, MultiCurve and MultiSurface
GDAL.OSRAxisMappingStrategyType
OSRAxisMappingStrategy

Data axis to CRS axis mapping strategy.

EnumeratorNote
OAMS_TRADITIONAL_GIS_ORDERTraditional GIS order
OAMS_AUTHORITY_COMPLIANTCompliant with the order mandated by the CRS authority
OAMS_CUSTOMCustom
GDAL.OSRCRSInfoType
OSRCRSInfo

Structure given overall description of a CRS.

This structure may grow over time, and should not be directly allocated by client code.

FieldNote
pszAuthNameAuthority name.
pszCodeObject code.
pszNameObject name.
eTypeObject type.
bDeprecatedWhether the object is deprecated
bBboxValidWhereas the west_lon_degree, south_lat_degree, east_lon_degree and north_lat_degree fields are valid.
dfWestLongitudeDegWestern-most longitude of the area of use, in degrees.
dfSouthLatitudeDegSouthern-most latitude of the area of use, in degrees.
dfEastLongitudeDegEastern-most longitude of the area of use, in degrees.
dfNorthLatitudeDegNorthern-most latitude of the area of use, in degrees.
pszAreaNameName of the area of use.
pszProjectionMethodName of the projection method for a projected CRS. Might be NULL evenfor projected CRS in some cases.
GDAL.OSRCRSTypeType
OSRCRSType

Type of Coordinate Reference System (CRS).

EnumeratorNote
OSR_CRS_TYPE_GEOGRAPHIC_2DGeographic 2D CRS
OSR_CRS_TYPE_GEOGRAPHIC_3DGeographic 3D CRS
OSR_CRS_TYPE_GEOCENTRICGeocentric CRS
OSR_CRS_TYPE_PROJECTEDProjected CRS
OSR_CRS_TYPE_VERTICALVertical CRS
OSR_CRS_TYPE_COMPOUNDCompound CRS
OSR_CRS_TYPE_OTHEROther
GDAL.VSIDIREntryType
VSIDIREntry

Directory entry.

FieldNote
pszNameFilename
nModeFile mode. See VSI_ISREG() / VSI_ISDIR()
nSizeFile size
nMTimeLast modification time (seconds since 1970/01/01)
bModeKnownWhether nMode is known: 0 = unknown, 1 = known.
bSizeKnownWhether nSize is known: 0 = unknown, 1 = known.
bMTimeKnownWhether nMTime is known: 0 = unknown, 1 = known.
papszExtraNULL-terminated list of extra properties.
GDAL.VSIFilesystemPluginAdviseReadCallbackType

This optional method is called when code plans to access soon one or several ranges in a file. Some file systems may be able to use this hint to for example asynchronously start such requests.

Offsets may be given in a non-increasing order, and may potentially overlap.

\since GDAL 3.7

Parameters

  • pFile: File handle.
  • nRanges: Size of the panOffsets and panSizes arrays.
  • panOffsets: Array containing the start offset of each range.
  • panSizes: Array containing the size (in bytes) of each range.
GDAL.VSIFilesystemPluginCallbacksStructType
VSIFilesystemPluginCallbacksStruct

struct containing callbacks to used by the handler. (rw), (r), (w) or () at the end indicate whether the given callback is mandatory for reading and or writing handlers. A (?) indicates that the callback might be mandatory for certain drivers only.

\since GDAL 3.0

FieldNote
pUserDataOptional opaque pointer passed back to filemanager callbacks (e.g. open, stat, rmdir)
statstat handle by name (rw)
unlinkunlink handle by name ()
renamerename handle ()
mkdirmake directory ()
rmdirremove directory ()
read_dirlist directory content (r?)
openopen handle by name (rw)
tellget current position of handle (rw)
seekset current position of handle (rw)
readread from current position (r)
read_multi_rangeread multiple blocks ()
get_range_statusget range status ()
eofhas end of file been reached (r?)
writewrite bytes to current position (w)
flushsync bytes (w)
truncatetruncate handle (w?)
closeclose handle (rw)
nBufferSizebuffer small reads (makes handler read only)
nCacheSizemax mem to use per file when buffering
sibling_fileslist related files
advise_readAdviseRead()
GDAL.VSIFilesystemPluginOpenCallbackType

Open a handle. Mandatory. Returns an opaque pointer that will be used in subsequent file I/O calls. Should return null and/or set errno if the handle does not exist or the access mode is incorrect.

\since GDAL 3.0

GDAL.VSIFilesystemPluginSiblingFilesCallbackType

List related files. Must return NULL if unknown, or a list of relative filenames that can be opened along the main file. If no other file than pszFilename needs to be opened, return static_cast<char**> (CPLCalloc(1,sizeof(char*)));

Optional

\since GDAL 3.2

GDAL.VSIRangeStatusType
VSIRangeStatus

Range status

EnumeratorNote
VSI_RANGE_STATUS_UNKNOWNUnknown
VSI_RANGE_STATUS_DATAData present
VSI_RANGE_STATUS_HOLEHole
GDAL.ogr_style_tool_class_idType
ogr_style_tool_class_id

OGRStyleTool derived class types (returned by GetType()).

EnumeratorNote
OGRSTCNoneNone
OGRSTCPenPen
OGRSTCBrushBrush
OGRSTCSymbolSymbol
OGRSTCLabelLabel
OGRSTCVectorVector
GDAL.ogr_style_tool_param_brush_idType
ogr_style_tool_param_brush_id

List of parameters for use with OGRStyleBrush.

EnumeratorNote
OGRSTBrushFColorForeground color
OGRSTBrushBColorBackground color
OGRSTBrushIdId
OGRSTBrushAngleAngle
OGRSTBrushSizeSize
OGRSTBrushDxDx
OGRSTBrushDyDy
OGRSTBrushPriorityPriority
GDAL.ogr_style_tool_param_label_idType
ogr_style_tool_param_label_id

List of parameters for use with OGRStyleLabel.

EnumeratorNote
OGRSTLabelFontNameFont name
OGRSTLabelSizeSize
OGRSTLabelTextStringText string
OGRSTLabelAngleAngle
OGRSTLabelFColorForeground color
OGRSTLabelBColorBackground color
OGRSTLabelPlacementPlacement
OGRSTLabelAnchorAnchor
OGRSTLabelDxDx
OGRSTLabelDyDy
OGRSTLabelPerpPerpendicular
OGRSTLabelBoldBold
OGRSTLabelItalicItalic
OGRSTLabelUnderlineUnderline
OGRSTLabelPriorityPriority
OGRSTLabelStrikeoutStrike out
OGRSTLabelStretchStretch
OGRSTLabelAdjHorOBSOLETE; do not use
OGRSTLabelAdjVert
OGRSTLabelHColorHighlight color
OGRSTLabelOColorOutline color
GDAL.ogr_style_tool_param_pen_idType
ogr_style_tool_param_pen_id

List of parameters for use with OGRStylePen.

EnumeratorNote
OGRSTPenColorColor
OGRSTPenWidthWidth
OGRSTPenPatternPattern
OGRSTPenIdId
OGRSTPenPerOffsetPerpendicular offset
OGRSTPenCapCap
OGRSTPenJoinJoin
OGRSTPenPriorityPriority
GDAL.ogr_style_tool_param_symbol_idType
ogr_style_tool_param_symbol_id

List of parameters for use with OGRStyleSymbol.

EnumeratorNote
OGRSTSymbolIdId
OGRSTSymbolAngleAngle
OGRSTSymbolColorColor
OGRSTSymbolSizeSize
OGRSTSymbolDxDx
OGRSTSymbolDyDy
OGRSTSymbolStepStep
OGRSTSymbolPerpPerpendicular
OGRSTSymbolOffsetOffset
OGRSTSymbolPriorityPriority
OGRSTSymbolFontNameFont name
OGRSTSymbolOColorOutline color
GDAL.ogr_style_tool_units_idType
ogr_style_tool_units_id

List of units supported by OGRStyleTools.

EnumeratorNote
OGRSTUGroundGround unit
OGRSTUPixelPixel
OGRSTUPointsPoints
OGRSTUMMMillimeter
OGRSTUCMCentimeter
OGRSTUInchesInch
GDAL._cplassertMethod
_CPLAssert(const char * pszExpression,
           const char * pszFile,
           int iLine) -> void

Report failure of a logical assertion.

GDAL.aftercareMethod

Handle anything returned from GDAL

When values are returned from GDAL, always check if there was a failure using maybe_throw. If the failure was thrown by GDAL itself, it will not even get to aftercare and end up in gdaljl_errorhandler. However in many cases even though GDAL sets the error state to CE_Failure it will not throw the error. However we always do, to make sure not failure goes unnoticed. If an error might be expected, one can use try .. catch to handle this.

Depending on the return type, we do extra work.

GDAL.aftercareMethod

For string pointers, load them to String, and free them if we should.

GDAL.aftercareMethod

For string list pointers, load them to Vector{String}

That is it expects a StringList, in the sense of the CPL functions, as a null-terminated array of strings.

GDAL.cpladdfileinzipMethod
CPLAddFileInZip(void * hZip,
                const char * pszArchiveFilename,
                const char * pszInputFilename,
                VSILFILE * fpInput,
                CSLConstList papszOptions,
                GDALProgressFunc pProgressFunc,
                void * pProgressData) -> CPLErr

Add a file inside a ZIP file opened/created with CPLCreateZip().

Parameters

  • hZip: ZIP file handle
  • pszArchiveFilename: Filename (in UTF-8) stored in the archive.
  • pszInputFilename: Filename of the file to add. If NULL, fpInput must not be NULL
  • fpInput: File handle opened on the file to add. May be NULL if pszInputFilename is provided.
  • papszOptions: Options.
  • pProgressFunc: Progress callback, or NULL.
  • pProgressData: User data of progress callback, or NULL.

Returns

CE_None in case of success.

GDAL.cpladdxmlattributeandvalueMethod
CPLAddXMLAttributeAndValue(CPLXMLNode * psParent,
                           const char * pszName,
                           const char * pszValue) -> void

Create an attribute and text value.

Parameters

  • psParent: the parent node to which the resulting node should be attached. Must not be NULL.
  • pszName: the attribute name to create.
  • pszValue: the text to attach to the attribute. Must not be NULL.
GDAL.cpladdxmlchildMethod
CPLAddXMLChild(CPLXMLNode * psParent,
               CPLXMLNode * psChild) -> void

Add child node to parent.

Parameters

  • psParent: the node to attach the child to. May not be NULL.
  • psChild: the child to add to the parent. May not be NULL. Should not be a child of any other parent.
GDAL.cpladdxmlsiblingMethod
CPLAddXMLSibling(CPLXMLNode * psOlderSibling,
                 CPLXMLNode * psNewSibling) -> void

Add new sibling.

Parameters

  • psOlderSibling: the node to attach the sibling after.
  • psNewSibling: the node to add at the end of psOlderSiblings psNext chain.
GDAL.cplatofMethod
CPLAtof(const char * nptr) -> double

Converts ASCII string to floating point number.

Parameters

  • nptr: Pointer to string to convert.

Returns

Converted value, if any.

GDAL.cplatofdelimMethod
CPLAtofDelim(const char * nptr,
             char point) -> double

Converts ASCII string to floating point number.

Parameters

  • nptr: Pointer to string to convert.
  • point: Decimal delimiter.

Returns

Converted value, if any.

GDAL.cplatofmMethod
CPLAtofM(const char * nptr) -> double

Converts ASCII string to floating point number using any numeric locale.

Parameters

  • nptr: The string to convert.

Returns

Converted value, if any. Zero on failure.

GDAL.cplatogintbigMethod
CPLAtoGIntBig(const char * pszString) -> GIntBig

Convert a string to a 64 bit signed integer.

Parameters

  • pszString: String containing 64 bit signed integer.

Returns

64 bit signed integer.

GDAL.cplatogintbigexMethod
CPLAtoGIntBigEx(const char * pszString,
                int bWarn,
                int * pbOverflow) -> GIntBig

Convert a string to a 64 bit signed integer.

Parameters

  • pszString: String containing 64 bit signed integer.
  • bWarn: Issue a warning if an overflow occurs during conversion
  • pbOverflow: Pointer to an integer to store if an overflow occurred, or NULL

Returns

64 bit signed integer.

GDAL.cplcallocMethod
CPLCalloc(size_t nCount,
          size_t nSize) -> void *

Safe version of calloc().

Parameters

  • nCount: number of objects to allocate.
  • nSize: size (in bytes) of object to allocate.

Returns

pointer to newly allocated memory, only NULL if nSize * nCount is NULL.

GDAL.cplcheckforfileMethod
CPLCheckForFile(char * pszFilename,
                char ** papszSiblingFiles) -> int

Check for file existence.

Parameters

  • pszFilename: name of file to check for - filename case updated in some cases.
  • papszSiblingFiles: a list of files in the same directory as pszFilename if available, or NULL. This list should have no path components.

Returns

TRUE if a match is found, or FALSE if not.

GDAL.cplcleantrailingslashMethod
CPLCleanTrailingSlash(const char * pszPath) -> const char *

Remove trailing forward/backward slash from the path for UNIX/Windows resp.

Parameters

  • pszPath: the path to be cleaned up

Returns

Path in an internal string which must not be freed. The string may be destroyed by the next CPL filename handling call.

GDAL.cplcleanxmlelementnameMethod
CPLCleanXMLElementName(char * pszTarget) -> void

Make string into safe XML token.

Parameters

  • pszTarget: the string to be adjusted. It is altered in place.
GDAL.cplclonexmltreeMethod
CPLCloneXMLTree(const CPLXMLNode * psTree) -> CPLXMLNode *

Copy tree.

Parameters

  • psTree: the tree to duplicate.

Returns

a copy of the whole tree.

GDAL.cplclosesharedMethod
CPLCloseShared(FILE * fp) -> void

Close shared file.

Parameters

  • fp: file handle from CPLOpenShared() to deaccess.
GDAL.cplcondtimedwaitMethod
CPLCondTimedWait(CPLCond * hCond,
                 CPLMutex * hMutex,
                 double dfWaitInSeconds) -> CPLCondTimedWaitReason
GDAL.cplcondwaitMethod
CPLCondWait(CPLCond * hCond,
            CPLMutex * hMutex) -> void
GDAL.cplcopyfileMethod
CPLCopyFile(const char * pszNewPath,
            const char * pszOldPath) -> int

Copy a file.

GDAL.cplcopytreeMethod
CPLCopyTree(const char * pszNewPath,
            const char * pszOldPath) -> int

Recursively copy a tree.

GDAL.cplcorrespondingpathsMethod
CPLCorrespondingPaths(const char * pszOldFilename,
                      const char * pszNewFilename,
                      char ** papszFileList) -> char **

Identify corresponding paths.

Parameters

  • pszOldFilename: path to old prototype file.
  • pszNewFilename: path to new prototype file.
  • papszFileList: list of other files associated with pszOldFilename to rename similarly.

Returns

a list of files corresponding to papszFileList but renamed to correspond to pszNewFilename.

GDAL.cplcreatexmlelementandvalueMethod
CPLCreateXMLElementAndValue(CPLXMLNode * psParent,
                            const char * pszName,
                            const char * pszValue) -> CPLXMLNode *

Create an element and text value.

Parameters

  • psParent: the parent node to which the resulting node should be attached. May be NULL to keep as freestanding.
  • pszName: the element name to create.
  • pszValue: the text to attach to the element. Must not be NULL.

Returns

the pointer to the new element node.

GDAL.cplcreatexmlnodeMethod
CPLCreateXMLNode(CPLXMLNode * poParent,
                 CPLXMLNodeType eType,
                 const char * pszText) -> CPLXMLNode *

Create an document tree item.

Parameters

  • poParent: the parent to which this node should be attached as a child. May be NULL to keep as free standing.
  • eType: the type of the newly created node
  • pszText: the value of the newly created node

Returns

the newly created node, now owned by the caller (or parent node).

GDAL.cpldectodmsMethod
CPLDecToDMS(double dfAngle,
            const char * pszAxis,
            int nPrecision) -> const char *

Translate a decimal degrees value to a DMS string with hemisphere.

GDAL.cpldectopackeddmsMethod
CPLDecToPackedDMS(double dfDec) -> double

Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).

Parameters

  • dfDec: Angle in decimal degrees.

Returns

Angle in packed DMS format.

GDAL.cpldefaultfindfileMethod
CPLDefaultFindFile(const char * pszClass,
                   const char * pszBasename) -> const char *

CPLDefaultFindFile.

GDAL.cpldestroyxmlnodeMethod
CPLDestroyXMLNode(CPLXMLNode * psNode) -> void

Destroy a tree.

Parameters

  • psNode: the tree to free.
GDAL.cpldumpsharedlistMethod
CPLDumpSharedList(FILE * fp) -> void

Report open shared files.

Parameters

  • fp: File handle to write to.
GDAL.cplexpandtildeMethod
CPLExpandTilde(const char * pszFilename) -> const char *

Expands ~/ at start of filename.

Parameters

  • pszFilename: filename potentially starting with ~/

Returns

an expanded filename.

GDAL.cplextractrelativepathMethod
CPLExtractRelativePath(const char * pszBaseDir,
                       const char * pszTarget,
                       int * pbGotRelative) -> const char *

Get relative path from directory to target file.

Parameters

  • pszBaseDir: the name of the directory relative to which the path should be computed. pszBaseDir may be NULL in which case the original target is returned without relativizing.
  • pszTarget: the filename to be changed to be relative to pszBaseDir.
  • pbGotRelative: Pointer to location in which a flag is placed indicating that the returned path is relative to the basename (TRUE) or not (FALSE). This pointer may be NULL if flag is not desired.

Returns

an adjusted path or the original if it could not be made relative to the pszBaseFile's path.

GDAL.cplfgetsMethod
CPLFGets(char * pszBuffer,
         int nBufferSize,
         FILE * fp) -> char *

Reads in at most one less than nBufferSize characters from the fp stream and stores them into the buffer pointed to by pszBuffer.

Parameters

  • pszBuffer: pointer to the targeting character buffer.
  • nBufferSize: maximum size of the string to read (not including terminating '\0').
  • fp: file pointer to read from.

Returns

pointer to the pszBuffer containing a string read from the file or NULL if the error or end of file was encountered.

GDAL.cplfindfileMethod
CPLFindFile(const char * pszClass,
            const char * pszBasename) -> const char *

CPLFindFile.

GDAL.cplformcifilenameMethod
CPLFormCIFilename(const char * pszPath,
                  const char * pszBasename,
                  const char * pszExtension) -> const char *

Case insensitive file searching, returning full path.

Parameters

  • pszPath: directory path to the directory containing the file. This may be relative or absolute, and may have a trailing path separator or not. May be NULL.
  • pszBasename: file basename. May optionally have path and/or extension. May not be NULL.
  • pszExtension: file extension, optionally including the period. May be NULL.

Returns

a fully formed filename in an internal static string. Do not modify or free the returned string. The string may be destroyed by the next CPL call.

GDAL.cplformfilenameMethod
CPLFormFilename(const char * pszPath,
                const char * pszBasename,
                const char * pszExtension) -> const char *

Build a full file path from a passed path, file basename and extension.

Parameters

  • pszPath: directory path to the directory containing the file. This may be relative or absolute, and may have a trailing path separator or not. May be NULL.
  • pszBasename: file basename. May optionally have path and/or extension. Must NOT be NULL.
  • pszExtension: file extension, optionally including the period. May be NULL.

Returns

a fully formed filename in an internal static string. Do not modify or free the returned string. The string may be destroyed by the next CPL call.

GDAL.cplgeneratetempfilenameMethod
CPLGenerateTempFilename(const char * pszStem) -> const char *

Generate temporary file name.

Parameters

  • pszStem: if non-NULL this will be part of the filename.

Returns

a filename which is valid till the next CPL call in this thread.

GDAL.cplgetbasenameMethod
CPLGetBasename(const char * pszFullFilename) -> const char *

Extract basename (non-directory, non-extension) portion of filename.

Parameters

  • pszFullFilename: the full filename potentially including a path.

Returns

just the non-directory, non-extension portion of the path in an internal string which must not be freed. The string may be destroyed by the next CPL filename handling call.

GDAL.cplgetcurrentdirMethod
CPLGetCurrentDir() -> char *

Get the current working directory name.

Returns

a pointer to buffer, containing current working directory path or NULL in case of error. User is responsible to free that buffer after usage with CPLFree() function. If HAVE_GETCWD macro is not defined, the function returns NULL.

GDAL.cplgetdirnameMethod
CPLGetDirname(const char * pszFilename) -> const char *

Extract directory path portion of filename.

Parameters

  • pszFilename: the filename potentially including a path.

Returns

Path in an internal string which must not be freed. The string may be destroyed by the next CPL filename handling call. The returned will generally not contain a trailing path separator.

GDAL.cplgetexecpathMethod
CPLGetExecPath(char * pszPathBuf,
               int nMaxLength) -> int

Fetch path of executable.

Parameters

  • pszPathBuf: the buffer into which the path is placed.
  • nMaxLength: the buffer size (including the nul-terminating character). MAX_PATH+1 is suggested.

Returns

FALSE on failure or TRUE on success.

GDAL.cplgetextensionMethod
CPLGetExtension(const char * pszFullFilename) -> const char *

Extract filename extension from full filename.

Parameters

  • pszFullFilename: the full filename potentially including a path.

Returns

just the extension portion of the path in an internal string which must not be freed. The string may be destroyed by the next CPL filename handling call.

GDAL.cplgetfilenameMethod
CPLGetFilename(const char * pszFullFilename) -> const char *

Extract non-directory portion of filename.

Parameters

  • pszFullFilename: the full filename potentially including a path.

Returns

just the non-directory portion of the path (points back into original string).

GDAL.cplgethomedirMethod
CPLGetHomeDir() -> const char *

Return the path to the home directory.

Returns

the home directory, or NULL.

GDAL.cplgetlasterrormsgMethod
CPLGetLastErrorMsg() -> const char *

Get the last error message.

Returns

the last error message, or NULL if there is no posted error message.

GDAL.cplgetpagesizeMethod
cplgetpagesize()

Return the size of a page of virtual memory.

\since GDAL 1.11

Returns

the page size.

GDAL.cplgetpathMethod
CPLGetPath(const char * pszFilename) -> const char *

Extract directory path portion of filename.

Parameters

  • pszFilename: the filename potentially including a path.

Returns

Path in an internal string which must not be freed. The string may be destroyed by the next CPL filename handling call. The returned will generally not contain a trailing path separator.

GDAL.cplgetphysicalramMethod
CPLGetPhysicalRAM(void) -> GIntBig

Return the total physical RAM in bytes.

Returns

the total physical RAM in bytes (or 0 in case of failure).

GDAL.cplgetsharedlistMethod
CPLGetSharedList(int * pnCount) -> CPLSharedFileInfo *

Fetch list of open shared files.

Parameters

  • pnCount: place to put the count of entries.

Returns

the pointer to the first in the array of shared file info structures.

GDAL.cplgetsymbolMethod
CPLGetSymbol(const char * pszLibrary,
             const char * pszSymbolName) -> void *

Fetch a function pointer from a shared library / DLL.

Parameters

  • pszLibrary: the name of the shared library or DLL containing the function. May contain path to file. If not system supplies search paths will be used.
  • pszSymbolName: the name of the function to fetch a pointer to.

Returns

A pointer to the function if found, or NULL if the function isn't found, or the shared library can't be loaded.

GDAL.cplgetthreadlocalconfigoptionMethod
CPLGetThreadLocalConfigOption(const char * pszKey,
                              const char * pszDefault) -> const char *

Same as CPLGetConfigOption() but only with options set with CPLSetThreadLocalConfigOption()

GDAL.cplgetthreadlocalconfigoptionsMethod
CPLGetThreadLocalConfigOptions(void) -> char **

Return the list of thread local configuration options as KEY=VALUE pairs.

Returns

a copy of the list, to be freed with CSLDestroy().

GDAL.cplgettlsexMethod
CPLGetTLSEx(int nIndex,
            int * pbMemoryErrorOccurred) -> void *
GDAL.cplgetusablephysicalramMethod
CPLGetUsablePhysicalRAM(void) -> GIntBig

Return the total physical RAM, usable by a process, in bytes.

Returns

the total physical RAM, usable by a process, in bytes (or 0 in case of failure).

GDAL.cplgetxmlnodeMethod
CPLGetXMLNode(CPLXMLNode * psRoot,
              const char * pszPath) -> CPLXMLNode *

Find node by path.

Parameters

  • psRoot: the subtree in which to search. This should be a node of type CXT_Element. NULL is safe.
  • pszPath: the list of element names in the path (dot separated).

Returns

the requested element node, or NULL if not found.

GDAL.cplgetxmlvalueMethod
CPLGetXMLValue(const CPLXMLNode * psRoot,
               const char * pszPath,
               const char * pszDefault) -> const char *

Fetch element/attribute value.

Parameters

  • psRoot: the subtree in which to search. This should be a node of type CXT_Element. NULL is safe.
  • pszPath: the list of element names in the path (dot separated). An empty path means get the value of the psRoot node.
  • pszDefault: the value to return if a corresponding value is not found, may be NULL.

Returns

the requested value or pszDefault if not found.

GDAL.cplisfilenamerelativeMethod
CPLIsFilenameRelative(const char * pszFilename) -> int

Is filename relative or absolute?

Parameters

  • pszFilename: the filename with path to test.

Returns

TRUE if the filename is relative or FALSE if it is absolute.

GDAL.cplisvirtualmemfilemapavailableMethod
cplisvirtualmemfilemapavailable()

Return if virtual memory mapping of a file is available.

\since GDAL 1.11

Returns

TRUE if virtual memory mapping of a file is available.

GDAL.cpllaunderforfilenameMethod
CPLLaunderForFilename(const char * pszName,
                      const char * pszOutputPath) -> const char *

Launder a string to be compatible of a filename.

Parameters

  • pszName: The input string to launder.
  • pszOutputPath: The directory where the file would be created. Unused for now. May be NULL.

Returns

the laundered name.

GDAL.cplloadconfigoptionsfromfileMethod
CPLLoadConfigOptionsFromFile(const char * pszFilename,
                             int bOverrideEnvVars) -> void

Load configuration from a given configuration file.

Parameters

  • pszFilename: File where to load configuration from.
  • bOverrideEnvVars: Whether configuration options from the configuration file should override environment variables.
GDAL.cpllockfileMethod
CPLLockFile(const char * pszPath,
            double dfWaitInSeconds) -> void *
GDAL.cplmallocMethod
CPLMalloc(size_t nSize) -> void *

Safe version of malloc().

Parameters

  • nSize: size (in bytes) of memory block to allocate.

Returns

pointer to newly allocated memory, only NULL if nSize is zero.

GDAL.cplmovefileMethod
CPLMoveFile(const char * pszNewPath,
            const char * pszOldPath) -> int

Move a file.

GDAL.cplopensharedMethod
CPLOpenShared(const char * pszFilename,
              const char * pszAccess,
              int bLargeIn) -> FILE *

Open a shared file handle.

Parameters

  • pszFilename: the name of the file to open.
  • pszAccess: the normal fopen()/VSIFOpen() style access string.
  • bLargeIn: If TRUE VSIFOpenL() (for large files) will be used instead of VSIFOpen().

Returns

a file handle or NULL if opening fails.

GDAL.cplpackeddmstodecMethod
CPLPackedDMSToDec(double dfPacked) -> double

Convert a packed DMS value (DDDMMMSSS.SS) into decimal degrees.

Parameters

  • dfPacked: Angle in packed DMS format.

Returns

Angle in decimal degrees.

GDAL.cplparsexmlfileMethod
CPLParseXMLFile(const char * pszFilename) -> CPLXMLNode *

Parse XML file into tree.

Parameters

  • pszFilename: the file to open.

Returns

NULL on failure, or the document tree on success.

GDAL.cplparsexmlstringMethod
CPLParseXMLString(const char * pszString) -> CPLXMLNode *

Parse an XML string into tree form.

Parameters

  • pszString: the document to parse.

Returns

parsed tree or NULL on error.

GDAL.cplprintdoubleMethod
CPLPrintDouble(char * pszBuffer,
               const char * pszFormat,
               double dfValue,
               const char * pszLocale) -> int

Print double value into specified string buffer.

Parameters

  • pszBuffer: Pointer to the destination string buffer. Should be large enough to hold the resulting string. Note, that the string will not be NULL-terminated, so user should do this himself, if needed.
  • pszFormat: Format specifier (for example, "%16.9E").
  • dfValue: Numerical value to print.
  • pszLocale: Unused.

Returns

Number of characters printed.

GDAL.cplprintint32Method
CPLPrintInt32(char * pszBuffer,
              GInt32 iValue,
              int nMaxLen) -> int

Print GInt32 value into specified string buffer.

Parameters

  • pszBuffer: Pointer to the destination string buffer. Should be large enough to hold the resulting string. Note, that the string will not be NULL-terminated, so user should do this himself, if needed.
  • iValue: Numerical value to print.
  • nMaxLen: Maximum length of the resulting string. If string length is greater than nMaxLen, it will be truncated.

Returns

Number of characters printed.

GDAL.cplprintpointerMethod
CPLPrintPointer(char * pszBuffer,
                void * pValue,
                int nMaxLen) -> int

Print pointer value into specified string buffer.

Parameters

  • pszBuffer: Pointer to the destination string buffer. Should be large enough to hold the resulting string. Note, that the string will not be NULL-terminated, so user should do this himself, if needed.
  • pValue: Pointer to ASCII encode.
  • nMaxLen: Maximum length of the resulting string. If string length is greater than nMaxLen, it will be truncated.

Returns

Number of characters printed.

GDAL.cplprintstringMethod
CPLPrintString(char * pszDest,
               const char * pszSrc,
               int nMaxLen) -> int

Copy the string pointed to by pszSrc, NOT including the terminating \0 character, to the array pointed to by pszDest.

Parameters

  • pszDest: Pointer to the destination string buffer. Should be large enough to hold the resulting string.
  • pszSrc: Pointer to the source buffer.
  • nMaxLen: Maximum length of the resulting string. If string length is greater than nMaxLen, it will be truncated.

Returns

Number of characters printed.

GDAL.cplprintstringfillMethod
CPLPrintStringFill(char * pszDest,
                   const char * pszSrc,
                   int nMaxLen) -> int

Copy the string pointed to by pszSrc, NOT including the terminating \0 character, to the array pointed to by pszDest.

Parameters

  • pszDest: Pointer to the destination string buffer. Should be large enough to hold the resulting string.
  • pszSrc: Pointer to the source buffer.
  • nMaxLen: Maximum length of the resulting string. If string length is greater than nMaxLen, it will be truncated.

Returns

Number of characters printed.

GDAL.cplprinttimeMethod
CPLPrintTime(char * pszBuffer,
             int nMaxLen,
             const char * pszFormat,
             const struct tm * poBrokenTime,
             const char * pszLocale) -> int

Print specified time value accordingly to the format options and specified locale name.

Parameters

  • pszBuffer: Pointer to the destination string buffer. Should be large enough to hold the resulting string. Note, that the string will not be NULL-terminated, so user should do this himself, if needed.
  • nMaxLen: Maximum length of the resulting string. If string length is greater than nMaxLen, it will be truncated.
  • pszFormat: Controls the output format. Options are the same as for strftime(3) function.
  • poBrokenTime: Pointer to the broken-down time structure. May be requested with the VSIGMTime() and VSILocalTime() functions.
  • pszLocale: Pointer to a character string containing locale name ("C", "POSIX", "usUS", "ruRU.KOI8-R" etc.). If NULL we will not manipulate with locale settings and current process locale will be used for printing. Be aware that it may be unsuitable to use current locale for printing time, because all names will be printed in your native language, as well as time format settings also may be adjusted differently from the C/POSIX defaults. To solve these problems this option was introduced.

Returns

Number of characters printed.

GDAL.cplprintuintbigMethod
CPLPrintUIntBig(char * pszBuffer,
                GUIntBig iValue,
                int nMaxLen) -> int

Print GUIntBig value into specified string buffer.

Parameters

  • pszBuffer: Pointer to the destination string buffer. Should be large enough to hold the resulting string. Note, that the string will not be NULL-terminated, so user should do this himself, if needed.
  • iValue: Numerical value to print.
  • nMaxLen: Maximum length of the resulting string. If string length is greater than nMaxLen, it will be truncated.

Returns

Number of characters printed.

GDAL.cplprojectrelativefilenameMethod
CPLProjectRelativeFilename(const char * pszProjectDir,
                           const char * pszSecondaryFilename) -> const char *

Find a file relative to a project file.

Parameters

  • pszProjectDir: the directory relative to which the secondary files path should be interpreted.
  • pszSecondaryFilename: the filename (potentially with path) that is to be interpreted relative to the project directory.

Returns

a composed path to the secondary file. The returned string is internal and should not be altered, freed, or depending on past the next CPL call.

GDAL.cplreadlineMethod
CPLReadLine(FILE * fp) -> const char *

Simplified line reading from text file.

Parameters

  • fp: file pointer opened with VSIFOpen().

Returns

pointer to an internal buffer containing a line of text read from the file or NULL if the end of file was encountered.

GDAL.cplreadline2lMethod
CPLReadLine2L(VSILFILE * fp,
              int nMaxCars,
              CSLConstList papszOptions) -> const char *

Simplified line reading from text file.

Parameters

  • fp: file pointer opened with VSIFOpenL().
  • nMaxCars: maximum number of characters allowed, or -1 for no limit.
  • papszOptions: NULL-terminated array of options. Unused for now.

Returns

pointer to an internal buffer containing a line of text read from the file or NULL if the end of file was encountered or the maximum number of characters allowed reached.

GDAL.cplreadline3lMethod
CPLReadLine3L(VSILFILE * fp,
              int nMaxCars,
              int * pnBufLength,
              CSLConstList papszOptions) -> const char *

Simplified line reading from text file.

Parameters

  • fp: file pointer opened with VSIFOpenL().
  • nMaxCars: maximum number of characters allowed, or -1 for no limit.
  • papszOptions: NULL-terminated array of options. Unused for now.
  • pnBufLength: size of output string (must be non-NULL)

Returns

pointer to an internal buffer containing a line of text read from the file or NULL if the end of file was encountered or the maximum number of characters allowed reached.

GDAL.cplreadlinelMethod
CPLReadLineL(VSILFILE * fp) -> const char *

Simplified line reading from text file.

Parameters

  • fp: file pointer opened with VSIFOpenL().

Returns

pointer to an internal buffer containing a line of text read from the file or NULL if the end of file was encountered.

GDAL.cplreallocMethod
CPLRealloc(void * pData,
           size_t nNewSize) -> void *

Safe version of realloc().

Parameters

  • pData: existing memory block which should be copied to the new block.
  • nNewSize: new size (in bytes) of memory block to allocate.

Returns

pointer to allocated memory, only NULL if nNewSize is zero.

GDAL.cplremovexmlchildMethod
CPLRemoveXMLChild(CPLXMLNode * psParent,
                  CPLXMLNode * psChild) -> int

Remove child node from parent.

Parameters

  • psParent: the node to the child is attached to.
  • psChild: the child to remove.

Returns

TRUE on success or FALSE if the child was not found.

GDAL.cplresetextensionMethod
CPLResetExtension(const char * pszPath,
                  const char * pszExt) -> const char *

Replace the extension with the provided one.

Parameters

  • pszPath: the input path, this string is not altered.
  • pszExt: the new extension to apply to the given path.

Returns

an altered filename with the new extension. Do not modify or free the returned string. The string may be destroyed by the next CPL call.

GDAL.cplscandoubleMethod
CPLScanDouble(const char * pszString,
              int nMaxLength) -> double

Extract double from string.

Parameters

  • pszString: String containing characters to be scanned. It may be terminated with a null character.
  • nMaxLength: The maximum number of character to consider as part of the number. Less characters will be considered if a null character is encountered.

Returns

Double value, converted from its ASCII form.

GDAL.cplscanlongMethod
CPLScanLong(const char * pszString,
            int nMaxLength) -> long

Scan up to a maximum number of characters from a string and convert the result to a long.

Parameters

  • pszString: String containing characters to be scanned. It may be terminated with a null character.
  • nMaxLength: The maximum number of character to consider as part of the number. Less characters will be considered if a null character is encountered.

Returns

Long value, converted from its ASCII form.

GDAL.cplscanpointerMethod
CPLScanPointer(const char * pszString,
               int nMaxLength) -> void *

Extract pointer from string.

Parameters

  • pszString: String containing characters to be scanned. It may be terminated with a null character.
  • nMaxLength: The maximum number of character to consider as part of the number. Less characters will be considered if a null character is encountered.

Returns

pointer value, converted from its ASCII form.

GDAL.cplscanstringMethod
CPLScanString(const char * pszString,
              int nMaxLength,
              int bTrimSpaces,
              int bNormalize) -> char *

Scan up to a maximum number of characters from a given string, allocate a buffer for a new string and fill it with scanned characters.

Parameters

  • pszString: String containing characters to be scanned. It may be terminated with a null character.
  • nMaxLength: The maximum number of character to read. Less characters will be read if a null character is encountered.
  • bTrimSpaces: If TRUE, trim ending spaces from the input string. Character considered as empty using isspace(3) function.
  • bNormalize: If TRUE, replace ':' symbol with the '_'. It is needed if resulting string will be used in CPL dictionaries.

Returns

Pointer to the resulting string buffer. Caller responsible to free this buffer with CPLFree().

GDAL.cplscanuintbigMethod
CPLScanUIntBig(const char * pszString,
               int nMaxLength) -> GUIntBig

Extract big integer from string.

Parameters

  • pszString: String containing characters to be scanned. It may be terminated with a null character.
  • nMaxLength: The maximum number of character to consider as part of the number. Less characters will be considered if a null character is encountered.

Returns

GUIntBig value, converted from its ASCII form.

GDAL.cplscanulongMethod
CPLScanULong(const char * pszString,
             int nMaxLength) -> unsigned long

Scan up to a maximum number of characters from a string and convert the result to a unsigned long.

Parameters

  • pszString: String containing characters to be scanned. It may be terminated with a null character.
  • nMaxLength: The maximum number of character to consider as part of the number. Less characters will be considered if a null character is encountered.

Returns

Unsigned long value, converted from its ASCII form.

GDAL.cplsearchxmlnodeMethod
CPLSearchXMLNode(CPLXMLNode * psRoot,
                 const char * pszElement) -> CPLXMLNode *

Search for a node in document.

Parameters

  • psRoot: the subtree to search. This should be a node of type CXT_Element. NULL is safe.
  • pszElement: the name of the element or attribute to search for.

Returns

The matching node or NULL on failure.

GDAL.cplserializexmltreeMethod
CPLSerializeXMLTree(const CPLXMLNode * psNode) -> char *

Convert tree into string document.

Parameters

  • psNode: the node to serialize.

Returns

the document on success or NULL on failure.

GDAL.cplserializexmltreetofileMethod
CPLSerializeXMLTreeToFile(const CPLXMLNode * psTree,
                          const char * pszFilename) -> int

Write document tree to a file.

Parameters

  • psTree: the document tree to write.
  • pszFilename: the name of the file to write to.

Returns

TRUE on success, FALSE otherwise.

GDAL.cplsetconfigoptionMethod
CPLSetConfigOption(const char * pszKey,
                   const char * pszValue) -> void

Set a configuration option for GDAL/OGR use.

Parameters

  • pszKey: the key of the option
  • pszValue: the value of the option, or NULL to clear a setting.
GDAL.cplsetconfigoptionsMethod
CPLSetConfigOptions(const char *const * papszConfigOptions) -> void

Replace the full list of configuration options with the passed list of KEY=VALUE pairs.

Parameters

  • papszConfigOptions: the new list (or NULL).
GDAL.cplsetlocaleMethod
CPLsetlocale(int category,
             const char * locale) -> char *

Prevents parallel executions of setlocale().

Parameters

  • category: See your compiler's documentation on setlocale.
  • locale: See your compiler's documentation on setlocale.

Returns

See your compiler's documentation on setlocale.

GDAL.cplsetthreadlocalconfigoptionMethod
CPLSetThreadLocalConfigOption(const char * pszKey,
                              const char * pszValue) -> void

Set a configuration option for GDAL/OGR use.

Parameters

  • pszKey: the key of the option
  • pszValue: the value of the option, or NULL to clear a setting.
GDAL.cplsetthreadlocalconfigoptionsMethod
CPLSetThreadLocalConfigOptions(const char *const * papszConfigOptions) -> void

Replace the full list of thread local configuration options with the passed list of KEY=VALUE pairs.

Parameters

  • papszConfigOptions: the new list (or NULL).
GDAL.cplsettlsMethod
CPLSetTLS(int nIndex,
          void * pData,
          int bFreeOnExit) -> void
GDAL.cplsettlswithfreefuncexMethod
CPLSetTLSWithFreeFuncEx(int nIndex,
                        void * pData,
                        CPLTLSFreeFunc pfnFree,
                        int * pbMemoryErrorOccurred) -> void
GDAL.cplsetxmlvalueMethod
CPLSetXMLValue(CPLXMLNode * psRoot,
               const char * pszPath,
               const char * pszValue) -> int

Set element value by path.

Parameters

  • psRoot: the subdocument to be updated.
  • pszPath: the dot separated path to the target element/attribute.
  • pszValue: the text value to assign.

Returns

TRUE on success.

GDAL.cplstatMethod
CPLStat(const char * pszPath,
        VSIStatBuf * psStatBuf) -> int

Same as VSIStat() except it works on "C:" as if it were "C:\".

GDAL.cplstrdupMethod
CPLStrdup(const char * pszString) -> char *

Safe version of strdup() function.

Parameters

  • pszString: input string to be duplicated. May be NULL.

Returns

pointer to a newly allocated copy of the string. Free with CPLFree() or VSIFree().

GDAL.cplstringtocomplexMethod
CPLStringToComplex(const char * pszString,
                   double * pdfReal,
                   double * pdfImag) -> void

Fetch the real and imaginary part of a serialized complex number.

GDAL.cplstripxmlnamespaceMethod
CPLStripXMLNamespace(CPLXMLNode * psRoot,
                     const char * pszNamespace,
                     int bRecurse) -> void

Strip indicated namespaces.

Parameters

  • psRoot: the document to operate on.
  • pszNamespace: the name space prefix (not including colon), or NULL.
  • bRecurse: TRUE to recurse over whole document, or FALSE to only operate on the passed node.
GDAL.cplstrlwrMethod
CPLStrlwr(char * pszString) -> char *

Convert each characters of the string to lower case.

Parameters

  • pszString: input string to be converted.

Returns

pointer to the same string, pszString.

GDAL.cplstrtodMethod
CPLStrtod(const char * nptr,
          char ** endptr) -> double

Converts ASCII string to floating point number.

Parameters

  • nptr: Pointer to string to convert.
  • endptr: If is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr.

Returns

Converted value, if any.

GDAL.cplstrtoddelimMethod
CPLStrtodDelim(const char * nptr,
               char ** endptr,
               char point) -> double

Converts ASCII string to floating point number using specified delimiter.

Parameters

  • nptr: Pointer to string to convert.
  • endptr: If is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr.
  • point: Decimal delimiter.

Returns

Converted value, if any.

GDAL.cplstrtofMethod
CPLStrtof(const char * nptr,
          char ** endptr) -> float

Converts ASCII string to floating point number.

Parameters

  • nptr: Pointer to string to convert.
  • endptr: If is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr.

Returns

Converted value, if any.

GDAL.cplstrtofdelimMethod
CPLStrtofDelim(const char * nptr,
               char ** endptr,
               char point) -> float

Converts ASCII string to floating point number using specified delimiter.

Parameters

  • nptr: Pointer to string to convert.
  • endptr: If is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr.
  • point: Decimal delimiter.

Returns

Converted value, if any.

GDAL.cplsubscribetosetconfigoptionMethod
CPLSubscribeToSetConfigOption(CPLSetConfigOptionSubscriber pfnCallback,
                              void * pUserData) -> int

Install a callback that will be notified of calls to CPLSetConfigOption()/ CPLSetThreadLocalConfigOption()

Parameters

  • pfnCallback: Callback. Must not be NULL
  • pUserData: Callback user data. May be NULL.

Returns

subscriber ID that can be used with CPLUnsubscribeToSetConfigOption()

GDAL.cplsymlinkMethod
CPLSymlink(const char * pszOldPath,
           const char * pszNewPath,
           CSLConstList) -> int

Create a symbolic link.

GDAL.cplunlinktreeMethod
CPLUnlinkTree(const char * pszPath) -> int

Recursively unlink a directory.

Returns

0 on successful completion, -1 if function fails.

GDAL.cplunsubscribetosetconfigoptionMethod
CPLUnsubscribeToSetConfigOption(int nId) -> void

Remove a subscriber installed with CPLSubscribeToSetConfigOption()

Parameters

  • nId: Subscriber id returned by CPLSubscribeToSetConfigOption()
GDAL.cplvalidatexmlMethod
CPLValidateXML(const char * pszXMLFilename,
               const char * pszXSDFilename,
               CSLConstList papszOptions) -> int

Validate a XML file against a XML schema.

Parameters

  • pszXMLFilename: the filename of the XML file to validate.
  • pszXSDFilename: the filename of the XSD schema.
  • papszOptions: unused for now. Set to NULL.

Returns

TRUE if the XML file validates against the XML schema.

GDAL.cplvirtualmemdeclarethreadMethod
cplvirtualmemdeclarethread(ctxt)

Declare that a thread will access a virtual memory mapping.

This function must be called by a thread that wants to access the content of a virtual memory mapping, except if the virtual memory mapping has been created with bSingleThreadUsage = TRUE.

This function must be paired with CPLVirtualMemUnDeclareThread().

\since GDAL 1.11

Parameters

GDAL.cplvirtualmemderivednewMethod
cplvirtualmemderivednew(pVMemBase, nOffset, nSize, pfnFreeUserData, pCbkUserData)

Create a new virtual memory mapping derived from an other virtual memory mapping.

This may be useful in case of creating mapping for pixel interleaved data.

The new mapping takes a reference on the base mapping.

\since GDAL 1.11

Parameters

  • pVMemBase: Base virtual memory mapping
  • nOffset: Offset in the base virtual memory mapping from which to start the new mapping.
  • nSize: Size of the base virtual memory mapping to expose in the the new mapping.
  • pfnFreeUserData: callback that is called when the object is destroyed.
  • pCbkUserData: user data passed to pfnFreeUserData.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.cplvirtualmemfilemapnewMethod
cplvirtualmemfilemapnew(fp, nOffset, nLength, eAccessMode, pfnFreeUserData, pCbkUserData)

Create a new virtual memory mapping from a file.

The file must be a "real" file recognized by the operating system, and not a VSI extended virtual file.

In VIRTUALMEM_READWRITE mode, updates to the memory mapping will be written in the file.

On Linux AMD64 platforms, the maximum value for nLength is 128 TB. On Linux x86 platforms, the maximum value for nLength is 2 GB.

Supported on Linux only in GDAL <= 2.0, and all POSIX systems supporting mmap() in GDAL >= 2.1

\since GDAL 1.11

Parameters

  • fp: Virtual file handle.
  • nOffset: Offset in the file to start the mapping from.
  • nLength: Length of the portion of the file to map into memory.
  • eAccessMode: Permission to use for the virtual memory mapping. This must be consistent with how the file has been opened.
  • pfnFreeUserData: callback that is called when the object is destroyed.
  • pCbkUserData: user data passed to pfnFreeUserData.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.cplvirtualmemfreeMethod
cplvirtualmemfree(ctxt)

Free a virtual memory mapping.

The pointer returned by CPLVirtualMemGetAddr() will no longer be valid. If the virtual memory mapping was created with read/write permissions and that they are dirty (i.e. modified) pages, they will be flushed through the pfnUnCachePage callback before being freed.

\since GDAL 1.11

Parameters

GDAL.cplvirtualmemgetaccessmodeMethod
cplvirtualmemgetaccessmode(ctxt)

Return the access mode of the virtual memory mapping.

\since GDAL 1.11

Parameters

Returns

the access mode of the virtual memory mapping.

GDAL.cplvirtualmemgetaddrMethod
cplvirtualmemgetaddr(ctxt)

Return the pointer to the start of a virtual memory mapping.

The bytes in the range [p:p+CPLVirtualMemGetSize()-1] where p is the pointer returned by this function will be valid, until CPLVirtualMemFree() is called.

Note that if a range of bytes used as an argument of a system call (such as read() or write()) contains pages that have not been "realized", the system call will fail with EFAULT. CPLVirtualMemPin() can be used to work around this issue.

\since GDAL 1.11

Parameters

Returns

the pointer to the start of a virtual memory mapping.

GDAL.cplvirtualmemgetpagesizeMethod
cplvirtualmemgetpagesize(ctxt)

Return the page size associated to a virtual memory mapping.

The value returned will be at least CPLGetPageSize(), but potentially larger.

\since GDAL 1.11

Parameters

Returns

the page size

GDAL.cplvirtualmemgetsizeMethod
cplvirtualmemgetsize(ctxt)

Return the size of the virtual memory mapping.

\since GDAL 1.11

Parameters

Returns

the size of the virtual memory mapping.

GDAL.cplvirtualmemisaccessthreadsafeMethod
cplvirtualmemisaccessthreadsafe(ctxt)

Return TRUE if this memory mapping can be accessed safely from concurrent threads.

The situation that can cause problems is when several threads try to access a page of the mapping that is not yet mapped.

The return value of this function depends on whether bSingleThreadUsage has been set of not in CPLVirtualMemNew() and/or the implementation.

On Linux, this will always return TRUE if bSingleThreadUsage = FALSE.

\since GDAL 1.11

Parameters

Returns

TRUE if this memory mapping can be accessed safely from concurrent threads.

GDAL.cplvirtualmemisfilemappingMethod
cplvirtualmemisfilemapping(ctxt)

Return if the virtual memory mapping is a direct file mapping.

\since GDAL 1.11

Parameters

Returns

TRUE if the virtual memory mapping is a direct file mapping.

GDAL.cplvirtualmemnewMethod
cplvirtualmemnew(nSize, nCacheSize, nPageSizeHint, bSingleThreadUsage, eAccessMode, pfnCachePage, pfnUnCachePage, pfnFreeUserData, pCbkUserData)

Create a new virtual memory mapping.

This will reserve an area of virtual memory of size nSize, whose size might be potentially much larger than the physical memory available. Initially, no physical memory will be allocated. As soon as memory pages will be accessed, they will be allocated transparently and filled with the pfnCachePage callback. When the allowed cache size is reached, the least recently used pages will be unallocated.

On Linux AMD64 platforms, the maximum value for nSize is 128 TB. On Linux x86 platforms, the maximum value for nSize is 2 GB.

Only supported on Linux for now.

Note that on Linux, this function will install a SIGSEGV handler. The original handler will be restored by CPLVirtualMemManagerTerminate().

\since GDAL 1.11

Parameters

  • nSize: size in bytes of the virtual memory mapping.
  • nCacheSize: size in bytes of the maximum memory that will be really allocated (must ideally fit into RAM).
  • nPageSizeHint: hint for the page size. Must be a multiple of the system page size, returned by CPLGetPageSize(). Minimum value is generally 4096. Might be set to 0 to let the function determine a default page size.
  • bSingleThreadUsage: set to TRUE if there will be no concurrent threads that will access the virtual memory mapping. This can optimize performance a bit.
  • eAccessMode: permission to use for the virtual memory mapping.
  • pfnCachePage: callback triggered when a still unmapped page of virtual memory is accessed. The callback has the responsibility of filling the page with relevant values.
  • pfnUnCachePage: callback triggered when a dirty mapped page is going to be freed (saturation of cache, or termination of the virtual memory mapping). Might be NULL.
  • pfnFreeUserData: callback that can be used to free pCbkUserData. Might be NULL
  • pCbkUserData: user data passed to pfnCachePage and pfnUnCachePage.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.cplvirtualmempinMethod
cplvirtualmempin(ctxt, pAddr, nSize, bWriteOp)

Make sure that a region of virtual memory will be realized.

Calling this function is not required, but might be useful when debugging a process with tools like gdb or valgrind that do not naturally like segmentation fault signals.

It is also needed when wanting to provide part of virtual memory mapping to a system call such as read() or write(). If read() or write() is called on a memory region not yet realized, the call will fail with EFAULT.

\since GDAL 1.11

Parameters

  • ctxt: context returned by CPLVirtualMemNew().
  • pAddr: the memory region to pin.
  • nSize: the size of the memory region.
  • bWriteOp: set to TRUE if the memory are will be accessed in write mode.
GDAL.cplvirtualmemundeclarethreadMethod
cplvirtualmemundeclarethread(ctxt)

Declare that a thread will stop accessing a virtual memory mapping.

This function must be called by a thread that will no longer access the content of a virtual memory mapping, except if the virtual memory mapping has been created with bSingleThreadUsage = TRUE.

This function must be paired with CPLVirtualMemDeclareThread().

\since GDAL 1.11

Parameters

GDAL.cplzlibdeflateMethod
CPLZLibDeflate(const void *,
               size_t,
               int,
               void *,
               size_t,
               size_t * pnOutBytes) -> void *
GDAL.cplzlibinflateMethod
CPLZLibInflate(const void *,
               size_t,
               void *,
               size_t,
               size_t * pnOutBytes) -> void *
GDAL.gdal_cg_createMethod
GDAL_CG_Create(int nWidth,
               int nHeight,
               int bNoDataSet,
               double dfNoDataValue,
               double dfContourInterval,
               double dfContourBase,
               GDALContourWriter pfnWriter,
               void * pCBData) -> GDALContourGeneratorH

Create contour generator.

GDAL.gdal_cg_destroyMethod
GDAL_CG_Destroy(GDALContourGeneratorH hCG) -> void

Destroy contour generator.

GDAL.gdal_cg_feedlineMethod
GDAL_CG_FeedLine(GDALContourGeneratorH hCG,
                 double * padfScanline) -> CPLErr

Feed a line to the contour generator.

GDAL.gdaladdbandMethod
GDALAddBand(GDALDatasetH hDataset,
            GDALDataType eType,
            CSLConstList papszOptions) -> CPLErr

Add a band to a dataset.

GDAL.gdaladdderivedbandpixelfuncMethod
GDALAddDerivedBandPixelFunc(const char * pszName,
                            GDALDerivedPixelFunc pfnNewFunction) -> CPLErr

This adds a pixel function to the global list of available pixel functions for derived bands.

Parameters

  • pszName: Name used to access pixel function
  • pfnNewFunction: Pixel function associated with name. An existing pixel function registered with the same name will be replaced with the new one.

Returns

CE_None, invalid (NULL) parameters are currently ignored.

GDAL.gdaladdderivedbandpixelfuncwithargsMethod
GDALAddDerivedBandPixelFuncWithArgs(const char * pszName,
                                    GDALDerivedPixelFuncWithArgs pfnNewFunction,
                                    const char * pszMetadata) -> CPLErr

This adds a pixel function to the global list of available pixel functions for derived bands.

Parameters

  • pszName: Name used to access pixel function
  • pfnNewFunction: Pixel function associated with name. An existing pixel function registered with the same name will be replaced with the new one.
  • pszMetadata: Pixel function metadata (not currently implemented)

Returns

CE_None, invalid (NULL) parameters are currently ignored.

GDAL.gdaladjustvaluetodatatypeMethod
GDALAdjustValueToDataType(GDALDataType eDT,
                          double dfValue,
                          int * pbClamped,
                          int * pbRounded) -> double

Adjust a value to the output data type.

Parameters

  • eDT: target data type.
  • dfValue: value to adjust.
  • pbClamped: pointer to a integer(boolean) to indicate if clamping has been made, or NULL
  • pbRounded: pointer to a integer(boolean) to indicate if rounding has been made, or NULL

Returns

adjusted value

GDAL.gdalapplygeotransformMethod
GDALApplyGeoTransform(double * padfGeoTransform,
                      double dfPixel,
                      double dfLine,
                      double * pdfGeoX,
                      double * pdfGeoY) -> void

Apply GeoTransform to x/y coordinate.

Parameters

  • padfGeoTransform: Six coefficient GeoTransform to apply.
  • dfPixel: Input pixel position.
  • dfLine: Input line position.
  • pdfGeoX: output location where geo_x (easting/longitude) location is placed.
  • pdfGeoY: output location where geo_y (northing/latitude) location is placed.
GDAL.gdalapplyverticalshiftgridMethod
gdalapplyverticalshiftgrid(hSrcDataset, hGridDataset, bInverse, dfSrcUnitToMeter, dfDstUnitToMeter, papszOptions)

GDAL.gdalapproxtransformMethod
GDALApproxTransform(void * pCBData,
                    int bDstToSrc,
                    int nPoints,
                    double * x,
                    double * y,
                    double * z,
                    int * panSuccess) -> int

Perform approximate transformation.

GDAL.gdalargetnextupdatedregionMethod
GDALARGetNextUpdatedRegion(GDALAsyncReaderH hARIO,
                           double dfTimeout,
                           int * pnBufXOff,
                           int * pnBufYOff,
                           int * pnBufXSize,
                           int * pnBufYSize) -> GDALAsyncStatusType

Get async IO update.

Parameters

  • hARIO: handle to the async reader.
  • dfTimeout: the number of seconds to wait for additional updates. Use -1 to wait indefinitely, or zero to not wait at all if there is no data available.
  • pnBufXOff: location to return the X offset of the area of the request buffer that has been updated.
  • pnBufYOff: location to return the Y offset of the area of the request buffer that has been updated.
  • pnBufXSize: location to return the X size of the area of the request buffer that has been updated.
  • pnBufYSize: location to return the Y size of the area of the request buffer that has been updated.

Returns

GARIO_ status, details described above.

GDAL.gdalarlockbufferMethod
GDALARLockBuffer(GDALAsyncReaderH hARIO,
                 double dfTimeout) -> int

Lock image buffer.

Parameters

  • hARIO: handle to async reader.
  • dfTimeout: the time in seconds to wait attempting to lock the buffer. -1.0 to wait indefinitely and 0 to not wait at all if it can't be acquired immediately. Default is -1.0 (infinite wait).

Returns

TRUE if successful, or FALSE on an error.

GDAL.gdalarunlockbufferMethod
GDALARUnlockBuffer(GDALAsyncReaderH hARIO) -> void

Unlock image buffer.

Parameters

  • hARIO: handle to async reader.
GDAL.gdalattributefreerawresultMethod
GDALAttributeFreeRawResult(GDALAttributeH hAttr,
                           GByte * raw,
                           size_t nSize) -> void

Free the return of GDALAttributeAsRaw()

GDAL.gdalattributegetdimensionssizeMethod
GDALAttributeGetDimensionsSize(GDALAttributeH hAttr,
                               size_t * pnCount) -> GUInt64 *

Return the dimension sizes of the attribute.

Parameters

  • hAttr: Attribute.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.

Returns

an array of *pnCount values.

GDAL.gdalattributegetnameMethod
GDALAttributeGetName(GDALAttributeH hAttr) -> const char *

Return the name of the attribute.

GDAL.gdalattributereadasdoubleMethod
GDALAttributeReadAsDouble(GDALAttributeH hAttr) -> double

Return the value of an attribute as a double.

Returns

a double value.

GDAL.gdalattributereadasdoublearrayMethod
GDALAttributeReadAsDoubleArray(GDALAttributeH hAttr,
                               size_t * pnCount) -> double *

Return the value of an attribute as an array of doubles.

Parameters

  • hAttr: Attribute
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.

Returns

array to be freed with CPLFree(), or nullptr.

GDAL.gdalattributereadasintMethod
GDALAttributeReadAsInt(GDALAttributeH hAttr) -> int

Return the value of an attribute as a integer.

Returns

a integer, or INT_MIN in case of error.

GDAL.gdalattributereadasintarrayMethod
GDALAttributeReadAsIntArray(GDALAttributeH hAttr,
                            size_t * pnCount) -> int *

Return the value of an attribute as an array of integers.

Parameters

  • hAttr: Attribute
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.

Returns

array to be freed with CPLFree(), or nullptr.

GDAL.gdalattributereadasrawMethod
GDALAttributeReadAsRaw(GDALAttributeH hAttr,
                       size_t * pnSize) -> GByte *

Return the raw value of an attribute.

Parameters

  • hAttr: Attribute.
  • pnSize: Pointer to the number of bytes returned. Must NOT be NULL.

Returns

a buffer of *pnSize bytes.

GDAL.gdalattributereadasstringMethod
GDALAttributeReadAsString(GDALAttributeH hAttr) -> const char *

Return the value of an attribute as a string.

Returns

a string, or nullptr.

GDAL.gdalattributereleaseMethod
GDALAttributeRelease(GDALAttributeH hAttr) -> void

Release the GDAL in-memory object associated with a GDALAttribute.

GDAL.gdalattributewritedoubleMethod
GDALAttributeWriteDouble(GDALAttributeH hAttr,
                         double dfVal) -> int

Write an attribute from a double value.

Parameters

  • hAttr: Attribute
  • dfVal: Value.

Returns

TRUE in case of success.

GDAL.gdalattributewritedoublearrayMethod
GDALAttributeWriteDoubleArray(GDALAttributeH hAttr,
                              const double * padfValues,
                              size_t nCount) -> int

Write an attribute from an array of double.

Parameters

  • hAttr: Attribute
  • padfValues: Array of double.
  • nCount: Should be equal to GetTotalElementsCount().

Returns

TRUE in case of success.

GDAL.gdalattributewriteintMethod
GDALAttributeWriteInt(GDALAttributeH hAttr,
                      int nVal) -> int

Write an attribute from a integer value.

Parameters

  • hAttr: Attribute
  • nVal: Value.

Returns

TRUE in case of success.

GDAL.gdalattributewriterawMethod
GDALAttributeWriteRaw(GDALAttributeH hAttr,
                      const void * pabyValue,
                      size_t nLength) -> int

Write an attribute from raw values expressed in GetDataType()

Parameters

  • hAttr: Attribute
  • pabyValue: Buffer of nLen bytes.
  • nLength: Size of pabyValue in bytes. Should be equal to GetTotalElementsCount() * GetDataType().GetSize()

Returns

TRUE in case of success.

GDAL.gdalattributewritestringMethod
GDALAttributeWriteString(GDALAttributeH hAttr,
                         const char * pszVal) -> int

Write an attribute from a string value.

Parameters

  • hAttr: Attribute
  • pszVal: Pointer to a string.

Returns

TRUE in case of success.

GDAL.gdalattributewritestringarrayMethod
GDALAttributeWriteStringArray(GDALAttributeH hAttr,
                              CSLConstList papszValues) -> int

Write an attribute from an array of strings.

Parameters

  • hAttr: Attribute
  • papszValues: Array of strings.

Returns

TRUE in case of success.

GDAL.gdalautocreatewarpedvrtexMethod
GDALAutoCreateWarpedVRTEx(GDALDatasetH hSrcDS,
                          const char * pszSrcWKT,
                          const char * pszDstWKT,
                          GDALResampleAlg eResampleAlg,
                          double dfMaxError,
                          const GDALWarpOptions * psOptionsIn,
                          CSLConstList papszTransformerOptions) -> GDALDatasetH

Create virtual warped dataset automatically.

GDAL.gdalbeginasyncreaderMethod
GDALBeginAsyncReader(GDALDatasetH hDS,
                     int nXOff,
                     int nYOff,
                     int nXSize,
                     int nYSize,
                     void * pBuf,
                     int nBufXSize,
                     int nBufYSize,
                     GDALDataType eBufType,
                     int nBandCount,
                     int * panBandMap,
                     int nPixelSpace,
                     int nLineSpace,
                     int nBandSpace,
                     CSLConstList papszOptions) -> GDALAsyncReaderH

Sets up an asynchronous data request.

Parameters

  • hDS: handle to the dataset object.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • pBuf: The buffer into which the data should be read. This buffer must contain at least nBufXSize * nBufYSize * nBandCount words of type eBufType. It is organized in left to right,top to bottom pixel order. Spacing is controlled by the nPixelSpace, and nLineSpace parameters.
  • nBufXSize: the width of the buffer image into which the desired region is to be read, or from which it is to be written.
  • nBufYSize: the height of the buffer image into which the desired region is to be read, or from which it is to be written.
  • eBufType: the type of the pixel values in the pData data buffer. The pixel values will automatically be translated to/from the GDALRasterBand data type as needed.
  • nBandCount: the number of bands being read or written.
  • panBandMap: the list of nBandCount band numbers being read/written. Note band numbers are 1 based. This may be NULL to select the first nBandCount bands.
  • nPixelSpace: The byte offset from the start of one pixel value in pData to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype eBufType is used.
  • nLineSpace: The byte offset from the start of one scanline in pData to the start of the next. If defaulted the size of the datatype eBufType * nBufXSize is used.
  • nBandSpace: the byte offset from the start of one bands data to the start of the next. If defaulted (zero) the value will be nLineSpace * nBufYSize implying band sequential organization of the data buffer.
  • papszOptions: Driver specific control options in a string list or NULL. Consult driver documentation for options supported.

Returns

handle representing the request.

GDAL.gdalbuildoverviewsMethod
GDALBuildOverviews(GDALDatasetH hDataset,
                   const char * pszResampling,
                   int nOverviews,
                   const int * panOverviewList,
                   int nListBands,
                   const int * panBandList,
                   GDALProgressFunc pfnProgress,
                   void * pProgressData) -> CPLErr

Build raster overview(s)

GDAL.gdalbuildoverviewsexMethod
GDALBuildOverviewsEx(GDALDatasetH hDataset,
                     const char * pszResampling,
                     int nOverviews,
                     const int * panOverviewList,
                     int nListBands,
                     const int * panBandList,
                     GDALProgressFunc pfnProgress,
                     void * pProgressData,
                     CSLConstList papszOptions) -> CPLErr

Build raster overview(s)

GDAL.gdalbuildvrtMethod
GDALBuildVRT(const char * pszDest,
             int nSrcCount,
             GDALDatasetH * pahSrcDS,
             const char *const * papszSrcDSNames,
             const GDALBuildVRTOptions * psOptionsIn,
             int * pbUsageError) -> GDALDatasetH

Build a VRT from a list of datasets.

Parameters

  • pszDest: the destination dataset path.
  • nSrcCount: the number of input datasets.
  • pahSrcDS: the list of input datasets (or NULL, exclusive with papszSrcDSNames)
  • papszSrcDSNames: the list of input dataset names (or NULL, exclusive with pahSrcDS)
  • psOptionsIn: the options struct returned by GDALBuildVRTOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred.

Returns

the output dataset (new dataset that must be closed using GDALClose()) or NULL in case of error.

GDAL.gdalbuildvrtoptionsfreeMethod
GDALBuildVRTOptionsFree(GDALBuildVRTOptions * psOptions) -> void

Frees the GDALBuildVRTOptions struct.

Parameters

  • psOptions: the options struct for GDALBuildVRT().
GDAL.gdalbuildvrtoptionsnewMethod
GDALBuildVRTOptionsNew(char ** papszArgv,
                       GDALBuildVRTOptionsForBinary * psOptionsForBinary) -> GDALBuildVRTOptions *

Allocates a GDALBuildVRTOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdalbuildvrt utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdalbuildvrt_bin.cpp use case) must be allocated with GDALBuildVRTOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALBuildVRTOptions struct. Must be freed with GDALBuildVRTOptionsFree().

GDAL.gdalbuildvrtoptionssetprogressMethod
GDALBuildVRTOptionsSetProgress(GDALBuildVRTOptions * psOptions,
                               GDALProgressFunc pfnProgress,
                               void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALBuildVRT().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalchecksumimageMethod
GDALChecksumImage(GDALRasterBandH hBand,
                  int nXOff,
                  int nYOff,
                  int nXSize,
                  int nYSize) -> int

Compute checksum for image region.

Parameters

  • hBand: the raster band to read from.
  • nXOff: pixel offset of window to read.
  • nYOff: line offset of window to read.
  • nXSize: pixel size of window to read.
  • nYSize: line size of window to read.

Returns

Checksum value, or -1 in case of error (starting with GDAL 3.6)

GDAL.gdalcheckversionMethod
gdalcheckversion(nVersionMajor, nVersionMinor, pszCallingComponentName)

Return TRUE if GDAL library version at runtime matches nVersionMajor.nVersionMinor.

The purpose of this method is to ensure that calling code will run with the GDAL version it is compiled for. It is primarily indented for external plugins.

Parameters

  • nVersionMajor: Major version to be tested against
  • nVersionMinor: Minor version to be tested against
  • pszCallingComponentName: If not NULL, in case of version mismatch, the method will issue a failure mentioning the name of the calling component.
GDAL.gdalchunkandwarpimageMethod
GDALChunkAndWarpImage(GDALWarpOperationH hOperation,
                      int nDstXOff,
                      int nDstYOff,
                      int nDstXSize,
                      int nDstYSize) -> CPLErr
GDAL.gdalchunkandwarpmultiMethod
GDALChunkAndWarpMulti(GDALWarpOperationH hOperation,
                      int nDstXOff,
                      int nDstYOff,
                      int nDstXSize,
                      int nDstYSize) -> CPLErr
GDAL.gdalclonecolortableMethod
GDALCloneColorTable(GDALColorTableH hTable) -> GDALColorTableH

Make a copy of a color table.

GDAL.gdalclonewarpoptionsMethod
GDALCloneWarpOptions(const GDALWarpOptions * psSrcOptions) -> GDALWarpOptions *

Clone a warp options structure.

GDAL.gdalcloseMethod
GDALClose(GDALDatasetH hDS) -> CPLErr

Close GDAL dataset.

Parameters

  • hDS: The dataset to close. May be cast from a "GDALDataset *".

Returns

CENone in case of success (return value since GDAL 3.7). On a shared dataset whose reference count is not dropped below 1, CENone will be returned.

GDAL.gdalcomposegeotransformsMethod
GDALComposeGeoTransforms(const double * padfGT1,
                         const double * padfGT2,
                         double * padfGTOut) -> void

Compose two geotransforms.

Parameters

  • padfGT1: the first geotransform, six values.
  • padfGT2: the second geotransform, six values.
  • padfGTOut: the output geotransform, six values, may safely be the same array as padfGT1 or padfGT2.
GDAL.gdalcomputebandstatsMethod
GDALComputeBandStats(GDALRasterBandH hSrcBand,
                     int nSampleStep,
                     double * pdfMean,
                     double * pdfStdDev,
                     GDALProgressFunc pfnProgress,
                     void * pProgressData) -> CPLErr

Undocumented.

Parameters

  • hSrcBand: undocumented.
  • nSampleStep: undocumented.
  • pdfMean: undocumented.
  • pdfStdDev: undocumented.
  • pfnProgress: undocumented.
  • pProgressData: undocumented.

Returns

undocumented

GDAL.gdalcomputematchingpointsMethod
GDALComputeMatchingPoints(GDALDatasetH hFirstImage,
                          GDALDatasetH hSecondImage,
                          char ** papszOptions,
                          int * pnGCPCount) -> GDAL_GCP *

GDALComputeMatchingPoints.

GDAL.gdalcomputemediancutpctMethod
GDALComputeMedianCutPCT(GDALRasterBandH hRed,
                        GDALRasterBandH hGreen,
                        GDALRasterBandH hBlue,
                        int(*)(int, int, void *) pfnIncludePixel,
                        int nColors,
                        GDALColorTableH hColorTable,
                        GDALProgressFunc pfnProgress,
                        void * pProgressArg) -> int

Compute optimal PCT for RGB image.

Parameters

  • hRed: Red input band.
  • hGreen: Green input band.
  • hBlue: Blue input band.
  • pfnIncludePixel: function used to test which pixels should be included in the analysis. At this time this argument is ignored and all pixels are utilized. This should normally be NULL.
  • nColors: the desired number of colors to be returned (2-256).
  • hColorTable: the colors will be returned in this color table object.
  • pfnProgress: callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
  • pProgressArg: callback argument passed to pfnProgress.

Returns

returns CENone on success or CEFailure if an error occurs.

GDAL.gdalcomputeproximityMethod
GDALComputeProximity(GDALRasterBandH hSrcBand,
                     GDALRasterBandH hProximityBand,
                     char ** papszOptions,
                     GDALProgressFunc pfnProgress,
                     void * pProgressArg) -> CPLErr

Compute the proximity of all pixels in the image to a set of pixels in the source image.

GDAL.gdalcomputerasterminmaxMethod
GDALComputeRasterMinMax(GDALRasterBandH hBand,
                        int bApproxOK,
                        double adfMinMax) -> CPLErr

Compute the min/max values for a band.

GDAL.gdalcomputerasterstatisticsMethod
GDALComputeRasterStatistics(GDALRasterBandH hBand,
                            int bApproxOK,
                            double * pdfMin,
                            double * pdfMax,
                            double * pdfMean,
                            double * pdfStdDev,
                            GDALProgressFunc pfnProgress,
                            void * pProgressData) -> CPLErr

Compute image statistics.

GDAL.gdalcontourgenerateMethod
gdalcontourgenerate(hBand, dfContourInterval, dfContourBase, nFixedLevelCount, padfFixedLevels, bUseNoData, dfNoDataValue, hLayer, iIDField, iElevField, pfnProgress, pProgressArg)

GDAL.gdalcontourgenerateexMethod
GDALContourGenerateEx(GDALRasterBandH hBand,
                      void * hLayer,
                      CSLConstList options,
                      GDALProgressFunc pfnProgress,
                      void * pProgressArg) -> CPLErr

Create vector contours from raster DEM.

Parameters

  • hBand: The band to read raster data from. The whole band will be processed.
  • hLayer: The layer to which new contour vectors will be written. Each contour will have a LINESTRING geometry attached to it (or POLYGON if POLYGONIZE=YES). This is really of type OGRLayerH, but void * is used to avoid pulling the ogr_api.h file in here.
  • pfnProgress: A GDALProgressFunc that may be used to report progress to the user, or to interrupt the algorithm. May be NULL if not required.
  • pProgressArg: The callback data for the pfnProgress function.
  • options: List of options

Returns

CENone on success or CEFailure if an error occurs.

GDAL.gdalcopybitsMethod
GDALCopyBits(const GByte * pabySrcData,
             int nSrcOffset,
             int nSrcStep,
             GByte * pabyDstData,
             int nDstOffset,
             int nDstStep,
             int nBitCount,
             int nStepCount) -> void

Bitwise word copying.

Parameters

  • pabySrcData: the source data buffer.
  • nSrcOffset: the offset (in bits) in pabySrcData to the start of the first word to copy.
  • nSrcStep: the offset in bits from the start one source word to the start of the next.
  • pabyDstData: the destination data buffer.
  • nDstOffset: the offset (in bits) in pabyDstData to the start of the first word to copy over.
  • nDstStep: the offset in bits from the start one word to the start of the next.
  • nBitCount: the number of bits in a word to be copied.
  • nStepCount: the number of words to copy.
GDAL.gdalcopydatasetfilesMethod
GDALCopyDatasetFiles(GDALDriverH hDriver,
                     const char * pszNewName,
                     const char * pszOldName) -> CPLErr

Copy the files of a dataset.

GDAL.gdalcopywordsMethod
GDALCopyWords(const void * pSrcData,
              GDALDataType eSrcType,
              int nSrcPixelStride,
              void * pDstData,
              GDALDataType eDstType,
              int nDstPixelStride,
              int nWordCount) -> void

Copy pixel words from buffer to buffer.

GDAL.gdalcopywords64Method
GDALCopyWords64(const void * pSrcData,
                GDALDataType eSrcType,
                int nSrcPixelStride,
                void * pDstData,
                GDALDataType eDstType,
                int nDstPixelStride,
                GPtrDiff_t nWordCount) -> void

Copy pixel words from buffer to buffer.

Parameters

  • pSrcData: Pointer to source data to be converted.
  • eSrcType: the source data type (see GDALDataType enum)
  • nSrcPixelStride: Source pixel stride (i.e. distance between 2 words), in bytes
  • pDstData: Pointer to buffer where destination data should go
  • eDstType: the destination data type (see GDALDataType enum)
  • nDstPixelStride: Destination pixel stride (i.e. distance between 2 words), in bytes
  • nWordCount: number of words to be copied
GDAL.gdalcreateMethod
GDALCreate(GDALDriverH hDriver,
           const char * pszFilename,
           int nXSize,
           int nYSize,
           int nBands,
           GDALDataType eBandType,
           CSLConstList papszOptions) -> GDALDatasetH

Create a new dataset with this driver.

GDAL.gdalcreateandreprojectimageMethod
GDALCreateAndReprojectImage(GDALDatasetH hSrcDS,
                            const char * pszSrcWKT,
                            const char * pszDstFilename,
                            const char * pszDstWKT,
                            GDALDriverH hDstDriver,
                            char ** papszCreateOptions,
                            GDALResampleAlg eResampleAlg,
                            double dfWarpMemoryLimit,
                            double dfMaxError,
                            GDALProgressFunc pfnProgress,
                            void * pProgressArg,
                            GDALWarpOptions * psOptions) -> CPLErr

Reproject an image and create the target reprojected image.

GDAL.gdalcreateapproxtransformerMethod
GDALCreateApproxTransformer(GDALTransformerFunc pfnBaseTransformer,
                            void * pBaseTransformArg,
                            double dfMaxError) -> void *

Create an approximating transformer.

Parameters

  • pfnBaseTransformer: the high precision transformer which should be approximated.
  • pBaseTransformArg: the callback argument for the high precision transformer.
  • dfMaxError: the maximum cartesian error in the "output" space that is to be accepted in the linear approximation.

Returns

callback pointer suitable for use with GDALApproxTransform(). It should be deallocated with GDALDestroyApproxTransformer().

GDAL.gdalcreatecolorrampMethod
GDALCreateColorRamp(GDALColorTableH hTable,
                    int nStartIndex,
                    const GDALColorEntry * psStartColor,
                    int nEndIndex,
                    const GDALColorEntry * psEndColor) -> void

Create color ramp.

GDAL.gdalcreatecolortableMethod
GDALCreateColorTable(GDALPaletteInterp eInterp) -> GDALColorTableH

Construct a new color table.

GDAL.gdalcreatecopyMethod
GDALCreateCopy(GDALDriverH hDriver,
               const char * pszFilename,
               GDALDatasetH hSrcDS,
               int bStrict,
               CSLConstList papszOptions,
               GDALProgressFunc pfnProgress,
               void * pProgressData) -> GDALDatasetH

Create a copy of a dataset.

GDAL.gdalcreategcprefinetransformerMethod
GDALCreateGCPRefineTransformer(int nGCPCount,
                               const GDAL_GCP * pasGCPList,
                               int nReqOrder,
                               int bReversed,
                               double dfTolerance,
                               int nMinimumGcps) -> void *

Create GCP based polynomial transformer, with a tolerance threshold to discard GCPs that transform badly.

GDAL.gdalcreategcptransformerMethod
GDALCreateGCPTransformer(int nGCPCount,
                         const GDAL_GCP * pasGCPList,
                         int nReqOrder,
                         int bReversed) -> void *

Create GCP based polynomial transformer.

Parameters

  • nGCPCount: the number of GCPs in pasGCPList.
  • pasGCPList: an array of GCPs to be used as input.
  • nReqOrder: the requested polynomial order. It should be 1, 2 or 3. Using 3 is not recommended due to potential numeric instabilities issues.
  • bReversed: set it to TRUE to compute the reversed transformation.

Returns

the transform argument or nullptr if creation fails.

GDAL.gdalcreategenimgprojtransformer2Method
GDALCreateGenImgProjTransformer2(GDALDatasetH hSrcDS,
                                 GDALDatasetH hDstDS,
                                 char ** papszOptions) -> void *

Create image to image transformer.

Parameters

  • hSrcDS: source dataset, or NULL.
  • hDstDS: destination dataset (or NULL).
  • papszOptions: NULL-terminated list of string options (or NULL).

Returns

handle suitable for use GDALGenImgProjTransform(), and to be deallocated with GDALDestroyGenImgProjTransformer() or NULL on failure.

GDAL.gdalcreategenimgprojtransformer3Method
GDALCreateGenImgProjTransformer3(const char * pszSrcWKT,
                                 const double * padfSrcGeoTransform,
                                 const char * pszDstWKT,
                                 const double * padfDstGeoTransform) -> void *

Create image to image transformer.

Parameters

  • pszSrcWKT: source WKT (or NULL).
  • padfSrcGeoTransform: source geotransform (or NULL).
  • pszDstWKT: destination WKT (or NULL).
  • padfDstGeoTransform: destination geotransform (or NULL).

Returns

handle suitable for use GDALGenImgProjTransform(), and to be deallocated with GDALDestroyGenImgProjTransformer() or NULL on failure.

GDAL.gdalcreategenimgprojtransformer4Method
GDALCreateGenImgProjTransformer4(OGRSpatialReferenceH hSrcSRS,
                                 const double * padfSrcGeoTransform,
                                 OGRSpatialReferenceH hDstSRS,
                                 const double * padfDstGeoTransform,
                                 const char *const * papszOptions) -> void *

Create image to image transformer.

GDAL.gdalcreategeoloctransformerMethod
GDALCreateGeoLocTransformer(GDALDatasetH hBaseDS,
                            char ** papszGeolocationInfo,
                            int bReversed) -> void *

Create GeoLocation transformer.

GDAL.gdalcreatemaskbandMethod
GDALCreateMaskBand(GDALRasterBandH hBand,
                   int nFlags) -> CPLErr

Adds a mask band to the current band.

GDAL.gdalcreatemultidimensionalMethod
GDALCreateMultiDimensional(GDALDriverH hDriver,
                           const char * pszName,
                           CSLConstList papszRootGroupOptions,
                           CSLConstList papszOptions) -> GDALDatasetH

Create a new multidimensional dataset with this driver.

GDAL.gdalcreatepansharpenedvrtMethod
GDALCreatePansharpenedVRT(const char * pszXML,
                          GDALRasterBandH hPanchroBand,
                          int nInputSpectralBands,
                          GDALRasterBandH * pahInputSpectralBands) -> GDALDatasetH

Create a virtual pansharpened dataset.

Parameters

  • pszXML: Pansharpened VRT XML where <SpectralBand> elements have no explicit SourceFilename and SourceBand. The spectral bands in the XML will be assigned the successive values of the pahInputSpectralBands array. Must not be NULL.
  • hPanchroBand: Panchromatic band. Must not be NULL.
  • nInputSpectralBands: Number of input spectral bands. Must be greater than zero.
  • pahInputSpectralBands: Array of nInputSpectralBands spectral bands.

Returns

NULL on failure, or a new virtual dataset handle on success to be closed with GDALClose().

GDAL.gdalcreatereprojectiontransformerMethod
GDALCreateReprojectionTransformer(const char * pszSrcWKT,
                                  const char * pszDstWKT) -> void *

Create reprojection transformer.

Parameters

  • pszSrcWKT: the coordinate system for the source coordinate system.
  • pszDstWKT: the coordinate system for the destination coordinate system.

Returns

Handle for use with GDALReprojectionTransform(), or NULL if the system fails to initialize the reprojection.

GDAL.gdalcreatereprojectiontransformerexMethod
GDALCreateReprojectionTransformerEx(OGRSpatialReferenceH hSrcSRS,
                                    OGRSpatialReferenceH hDstSRS,
                                    const char *const * papszOptions) -> void *

Create reprojection transformer.

Parameters

  • hSrcSRS: the coordinate system for the source coordinate system.
  • hDstSRS: the coordinate system for the destination coordinate system.
  • papszOptions: NULL-terminated list of options, or NULL. Currently supported options are:

AREAOFINTEREST=westlong,southlat,eastlong,northlat: Values in degrees. longitudes in [-180,180], latitudes in [-90,90].

COORDINATE_OPERATION=string: PROJ or WKT string representing a coordinate operation, overriding the default computed transformation.

COORDINATEEPOCH=decimalyear: Coordinate epoch, expressed as a decimal year. Useful for time-dependant coordinate operations.

SRCCOORDINATEEPOCH: (GDAL >= 3.4) Coordinate epoch of source CRS, expressed as a decimal year. Useful for time-dependant coordinate operations.

DSTCOORDINATEEPOCH: (GDAL >= 3.4) Coordinate epoch of target CRS, expressed as a decimal year. Useful for time-dependant coordinate operations.

Returns

Handle for use with GDALReprojectionTransform(), or NULL if the system fails to initialize the reprojection.

GDAL.gdalcreaterpctransformerv1Method
GDALCreateRPCTransformerV1(GDALRPCInfoV1 * psRPCInfo,
                           int bReversed,
                           double dfPixErrThreshold,
                           char ** papszOptions) -> void *
GDAL.gdalcreatescaledprogressMethod
GDALCreateScaledProgress(double dfMin,
                         double dfMax,
                         GDALProgressFunc pfnProgress,
                         void * pData) -> void *

Create scaled progress transformer.

Parameters

  • dfMin: the value to which 0.0 in the sub operation is mapped.
  • dfMax: the value to which 1.0 is the sub operation is mapped.
  • pfnProgress: the overall progress function.
  • pData: the overall progress function callback data.

Returns

pointer to pass as pProgressArg to sub functions. Should be freed with GDALDestroyScaledProgress().

GDAL.gdalcreatetpstransformerMethod
GDALCreateTPSTransformer(int nGCPCount,
                         const GDAL_GCP * pasGCPList,
                         int bReversed) -> void *

Create Thin Plate Spline transformer from GCPs.

Parameters

  • nGCPCount: the number of GCPs in pasGCPList.
  • pasGCPList: an array of GCPs to be used as input.
  • bReversed: set it to TRUE to compute the reversed transformation.

Returns

the transform argument or NULL if creation fails.

GDAL.gdalcreatewarpedvrtMethod
GDALCreateWarpedVRT(GDALDatasetH hSrcDS,
                    int nPixels,
                    int nLines,
                    double * padfGeoTransform,
                    GDALWarpOptions * psOptions) -> GDALDatasetH

Create virtual warped dataset.

Parameters

  • hSrcDS: The source dataset.
  • nPixels: Width of the virtual warped dataset to create
  • nLines: Height of the virtual warped dataset to create
  • padfGeoTransform: Geotransform matrix of the virtual warped dataset to create
  • psOptions: Warp options. Must be different from NULL.

Returns

NULL on failure, or a new virtual dataset handle on success.

GDAL.gdaldatasetabortsqlMethod
GDALDatasetAbortSQL(GDALDatasetH hDS) -> OGRErr

Abort any SQL statement running in the data store.

Parameters

  • hDS: the dataset handle.

Returns

OGRERRNONE on success, or OGRERRUNSUPPORTED_OPERATION if AbortSQL is not supported for this datasource. .

GDAL.gdaldatasetaddfielddomainMethod
GDALDatasetAddFieldDomain(GDALDatasetH hDS,
                          OGRFieldDomainH hFieldDomain,
                          char ** ppszFailureReason) -> bool

Add a field domain to the dataset.

Parameters

  • hDS: Dataset handle.
  • hFieldDomain: The domain definition. Contrary to the C++ version, the passed object is copied.
  • ppszFailureReason: Output parameter. Will contain an error message if an error occurs (*ppszFailureReason to be freed with CPLFree). May be NULL.

Returns

true in case of success.

GDAL.gdaldatasetaddrelationshipMethod
GDALDatasetAddRelationship(GDALDatasetH hDS,
                           GDALRelationshipH hRelationship,
                           char ** ppszFailureReason) -> bool

Add a relationship to the dataset.

Parameters

  • hDS: Dataset handle.
  • hRelationship: The relationship definition. Contrary to the C++ version, the passed object is copied.
  • ppszFailureReason: Output parameter. Will contain an error message if an error occurs (*ppszFailureReason to be freed with CPLFree). May be NULL.

Returns

true in case of success.

GDAL.gdaldatasetadvisereadMethod
GDALDatasetAdviseRead(GDALDatasetH hDS,
                      int nXOff,
                      int nYOff,
                      int nXSize,
                      int nYSize,
                      int nBufXSize,
                      int nBufYSize,
                      GDALDataType eDT,
                      int nBandCount,
                      int * panBandMap,
                      CSLConstList papszOptions) -> CPLErr

Advise driver of upcoming read requests.

GDAL.gdaldatasetcommittransactionMethod
GDALDatasetCommitTransaction(GDALDatasetH hDS) -> OGRErr

For datasources which support transactions, CommitTransaction commits a transaction.

Returns

OGRERR_NONE on success.

GDAL.gdaldatasetcopylayerMethod
GDALDatasetCopyLayer(GDALDatasetH hDS,
                     OGRLayerH hSrcLayer,
                     const char * pszNewName,
                     CSLConstList papszOptions) -> OGRLayerH

Duplicate an existing layer.

Parameters

  • hDS: the dataset handle.
  • hSrcLayer: source layer.
  • pszNewName: the name of the layer to create.
  • papszOptions: a StringList of name=value options. Options are driver specific.

Returns

a handle to the layer, or NULL if an error occurs.

GDAL.gdaldatasetcopywholerasterMethod
GDALDatasetCopyWholeRaster(GDALDatasetH hSrcDS,
                           GDALDatasetH hDstDS,
                           CSLConstList papszOptions,
                           GDALProgressFunc pfnProgress,
                           void * pProgressData) -> CPLErr

Copy all dataset raster data.

Parameters

  • hSrcDS: the source dataset
  • hDstDS: the destination dataset
  • papszOptions: transfer hints in "StringList" Name=Value format.
  • pfnProgress: progress reporting function.
  • pProgressData: callback data for progress function.

Returns

CENone on success, or CEFailure on failure.

GDAL.gdaldatasetcreatelayerMethod
GDALDatasetCreateLayer(GDALDatasetH hDS,
                       const char * pszName,
                       OGRSpatialReferenceH hSpatialRef,
                       OGRwkbGeometryType eGType,
                       CSLConstList papszOptions) -> OGRLayerH

This function attempts to create a new layer on the dataset with the indicated name, coordinate system, geometry type.

Parameters

  • hDS: the dataset handle
  • pszName: the name for the new layer. This should ideally not match any existing layer on the datasource.
  • hSpatialRef: the coordinate system to use for the new layer, or NULL if no coordinate system is available. The driver might only increase the reference counter of the object to take ownership, and not make a full copy, so do not use OSRDestroySpatialReference(), but OSRRelease() instead when you are done with the object.
  • eGType: the geometry type for the layer. Use wkbUnknown if there are no constraints on the types geometry to be written.
  • papszOptions: a StringList of name=value options. Options are driver specific.

Returns

NULL is returned on failure, or a new OGRLayer handle on success.

GDAL.gdaldatasetdeletefielddomainMethod
GDALDatasetDeleteFieldDomain(GDALDatasetH hDS,
                             const char * pszName,
                             char ** ppszFailureReason) -> bool

Removes a field domain from the dataset.

Parameters

  • hDS: Dataset handle.
  • pszName: The domain name.
  • ppszFailureReason: Output parameter. Will contain an error message if an error occurs (*ppszFailureReason to be freed with CPLFree). May be NULL.

Returns

true in case of success.

GDAL.gdaldatasetdeletelayerMethod
GDALDatasetDeleteLayer(GDALDatasetH hDS,
                       int iLayer) -> OGRErr

Delete the indicated layer from the datasource.

Parameters

  • hDS: the dataset handle.
  • iLayer: the index of the layer to delete.

Returns

OGRERRNONE on success, or OGRERRUNSUPPORTED_OPERATION if deleting layers is not supported for this datasource.

GDAL.gdaldatasetdeleterelationshipMethod
GDALDatasetDeleteRelationship(GDALDatasetH hDS,
                              const char * pszName,
                              char ** ppszFailureReason) -> bool

Removes a relationship from the dataset.

Parameters

  • hDS: Dataset handle.
  • pszName: The relationship name.
  • ppszFailureReason: Output parameter. Will contain an error message if an error occurs (*ppszFailureReason to be freed with CPLFree). May be NULL.

Returns

true in case of success.

GDAL.gdaldatasetexecutesqlMethod
GDALDatasetExecuteSQL(GDALDatasetH hDS,
                      const char * pszStatement,
                      OGRGeometryH hSpatialFilter,
                      const char * pszDialect) -> OGRLayerH

Execute an SQL statement against the data store.

Parameters

  • hDS: the dataset handle.
  • pszStatement: the SQL statement to execute.
  • hSpatialFilter: geometry which represents a spatial filter. Can be NULL.
  • pszDialect: allows control of the statement dialect. If set to NULL, the OGR SQL engine will be used, except for RDBMS drivers that will use their dedicated SQL engine, unless OGRSQL is explicitly passed as the dialect. Starting with OGR 1.10, the SQLITE dialect can also be used.

Returns

an OGRLayer containing the results of the query. Deallocate with GDALDatasetReleaseResultSet().

GDAL.gdaldatasetgetcompressionformatsMethod
GDALDatasetGetCompressionFormats(GDALDatasetH hDS,
                                 int nXOff,
                                 int nYOff,
                                 int nXSize,
                                 int nYSize,
                                 int nBandCount,
                                 const int * panBandList) -> char **

Return the compression formats that can be natively obtained for the window of interest and requested bands.

Parameters

  • hDS: Dataset handle.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • nBandCount: the number of bands being requested.
  • panBandList: the list of nBandCount band numbers. Note band numbers are 1 based. This may be NULL to select the first nBandCount bands.

Returns

a list of compatible formats (which may be empty) that should be freed with CSLDestroy(), or nullptr.

GDAL.gdaldatasetgetfielddomainMethod
GDALDatasetGetFieldDomain(GDALDatasetH hDS,
                          const char * pszName) -> OGRFieldDomainH

Get a field domain from its name.

Parameters

  • hDS: Dataset handle.
  • pszName: Name of field domain.

Returns

the field domain (ownership remains to the dataset), or nullptr if not found.

GDAL.gdaldatasetgetfielddomainnamesMethod
GDALDatasetGetFieldDomainNames(GDALDatasetH hDS,
                               CSLConstList papszOptions) -> char **

Returns a list of the names of all field domains stored in the dataset.

Parameters

  • hDS: Dataset handle.
  • papszOptions: Driver specific options determining how attributes should be retrieved. Pass nullptr for default behavior.

Returns

list of field domain names, to be freed with CSLDestroy()

GDAL.gdaldatasetgetlayerMethod
GDALDatasetGetLayer(GDALDatasetH hDS,
                    int iLayer) -> OGRLayerH

Fetch a layer by index.

Parameters

  • hDS: the dataset handle.
  • iLayer: a layer number between 0 and GetLayerCount()-1.

Returns

the layer, or NULL if iLayer is out of range or an error occurs.

GDAL.gdaldatasetgetlayerbynameMethod
GDALDatasetGetLayerByName(GDALDatasetH hDS,
                          const char * pszName) -> OGRLayerH

Fetch a layer by name.

Parameters

  • hDS: the dataset handle.
  • pszName: the layer name of the layer to fetch.

Returns

the layer, or NULL if Layer is not found or an error occurs.

GDAL.gdaldatasetgetlayercountMethod
GDALDatasetGetLayerCount(GDALDatasetH hDS) -> int

Get the number of layers in this dataset.

Parameters

  • hDS: the dataset handle.

Returns

layer count.

GDAL.gdaldatasetgetnextfeatureMethod
GDALDatasetGetNextFeature(GDALDatasetH hDS,
                          OGRLayerH * phBelongingLayer,
                          double * pdfProgressPct,
                          GDALProgressFunc pfnProgress,
                          void * pProgressData) -> OGRFeatureH

Fetch the next available feature from this dataset.

Parameters

  • hDS: dataset handle.
  • phBelongingLayer: a pointer to a OGRLayer* variable to receive the layer to which the object belongs to, or NULL. It is possible that the output of *ppoBelongingLayer to be NULL despite the feature not being NULL.
  • pdfProgressPct: a pointer to a double variable to receive the percentage progress (in [0,1] range), or NULL. On return, the pointed value might be negative if determining the progress is not possible.
  • pfnProgress: a progress callback to report progress (for GetNextFeature() calls that might have a long duration) and offer cancellation possibility, or NULL
  • pProgressData: user data provided to pfnProgress, or NULL

Returns

a feature, or NULL if no more features are available.

GDAL.gdaldatasetgetrelationshipMethod
GDALDatasetGetRelationship(GDALDatasetH hDS,
                           const char * pszName) -> GDALRelationshipH

Get a relationship from its name.

Parameters

  • hDS: Dataset handle.
  • pszName: Name of relationship.

Returns

the relationship (ownership remains to the dataset), or nullptr if not found.

GDAL.gdaldatasetgetrelationshipnamesMethod
GDALDatasetGetRelationshipNames(GDALDatasetH hDS,
                                CSLConstList papszOptions) -> char **

Returns a list of the names of all relationships stored in the dataset.

Parameters

  • hDS: Dataset handle.
  • papszOptions: Driver specific options determining how relationships should be retrieved. Pass nullptr for default behavior.

Returns

list of relationship names, to be freed with CSLDestroy()

GDAL.gdaldatasetgetstyletableMethod
GDALDatasetGetStyleTable(GDALDatasetH hDS) -> OGRStyleTableH

Returns dataset style table.

Parameters

  • hDS: the dataset handle

Returns

handle to a style table which should not be modified or freed by the caller.

GDAL.gdaldatasetgettiledvirtualmemMethod
GDALDatasetGetTiledVirtualMem(GDALDatasetH hDS,
                              GDALRWFlag eRWFlag,
                              int nXOff,
                              int nYOff,
                              int nXSize,
                              int nYSize,
                              int nTileXSize,
                              int nTileYSize,
                              GDALDataType eBufType,
                              int nBandCount,
                              int * panBandMap,
                              GDALTileOrganization eTileOrganization,
                              size_t nCacheSize,
                              int bSingleThreadUsage,
                              CSLConstList papszOptions) -> CPLVirtualMem *

Create a CPLVirtualMem object from a GDAL dataset object, with tiling organization.

Parameters

  • hDS: Dataset object
  • eRWFlag: Either GFRead to read a region of data, or GFWrite to write a region of data.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • nTileXSize: the width of the tiles.
  • nTileYSize: the height of the tiles.
  • eBufType: the type of the pixel values in the data buffer. The pixel values will automatically be translated to/from the GDALRasterBand data type as needed.
  • nBandCount: the number of bands being read or written.
  • panBandMap: the list of nBandCount band numbers being read/written. Note band numbers are 1 based. This may be NULL to select the first nBandCount bands.
  • eTileOrganization: tile organization.
  • nCacheSize: size in bytes of the maximum memory that will be really allocated (must ideally fit into RAM)
  • bSingleThreadUsage: set to TRUE if there will be no concurrent threads that will access the virtual memory mapping. This can optimize performance a bit. If set to FALSE, CPLVirtualMemDeclareThread() must be called.
  • papszOptions: NULL terminated list of options. Unused for now.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.gdaldatasetgetvirtualmemMethod
GDALDatasetGetVirtualMem(GDALDatasetH hDS,
                         GDALRWFlag eRWFlag,
                         int nXOff,
                         int nYOff,
                         int nXSize,
                         int nYSize,
                         int nBufXSize,
                         int nBufYSize,
                         GDALDataType eBufType,
                         int nBandCount,
                         int * panBandMap,
                         int nPixelSpace,
                         GIntBig nLineSpace,
                         GIntBig nBandSpace,
                         size_t nCacheSize,
                         size_t nPageSizeHint,
                         int bSingleThreadUsage,
                         CSLConstList papszOptions) -> CPLVirtualMem *

Create a CPLVirtualMem object from a GDAL dataset object.

Parameters

  • hDS: Dataset object
  • eRWFlag: Either GFRead to read a region of data, or GFWrite to write a region of data.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • nBufXSize: the width of the buffer image into which the desired region is to be read, or from which it is to be written.
  • nBufYSize: the height of the buffer image into which the desired region is to be read, or from which it is to be written.
  • eBufType: the type of the pixel values in the data buffer. The pixel values will automatically be translated to/from the GDALRasterBand data type as needed.
  • nBandCount: the number of bands being read or written.
  • panBandMap: the list of nBandCount band numbers being read/written. Note band numbers are 1 based. This may be NULL to select the first nBandCount bands.
  • nPixelSpace: The byte offset from the start of one pixel value in the buffer to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype eBufType is used.
  • nLineSpace: The byte offset from the start of one scanline in the buffer to the start of the next. If defaulted (0) the size of the datatype eBufType * nBufXSize is used.
  • nBandSpace: the byte offset from the start of one bands data to the start of the next. If defaulted (0) the value will be nLineSpace * nBufYSize implying band sequential organization of the data buffer.
  • nCacheSize: size in bytes of the maximum memory that will be really allocated (must ideally fit into RAM)
  • nPageSizeHint: hint for the page size. Must be a multiple of the system page size, returned by CPLGetPageSize(). Minimum value is generally 4096. Might be set to 0 to let the function determine a default page size.
  • bSingleThreadUsage: set to TRUE if there will be no concurrent threads that will access the virtual memory mapping. This can optimize performance a bit. If set to FALSE, CPLVirtualMemDeclareThread() must be called.
  • papszOptions: NULL terminated list of options. Unused for now.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.gdaldatasetislayerprivateMethod
GDALDatasetIsLayerPrivate(GDALDatasetH hDS,
                          int iLayer) -> int

Returns true if the layer at the specified index is deemed a private or system table, or an internal detail only.

Parameters

  • hDS: the dataset handle.
  • iLayer: a layer number between 0 and GetLayerCount()-1.

Returns

true if the layer is a private or system table.

GDAL.gdaldatasetrasterioMethod
GDALDatasetRasterIO(GDALDatasetH hDS,
                    GDALRWFlag eRWFlag,
                    int nXOff,
                    int nYOff,
                    int nXSize,
                    int nYSize,
                    void * pData,
                    int nBufXSize,
                    int nBufYSize,
                    GDALDataType eBufType,
                    int nBandCount,
                    int * panBandMap,
                    int nPixelSpace,
                    int nLineSpace,
                    int nBandSpace) -> CPLErr

Read/write a region of image data from multiple bands.

GDAL.gdaldatasetrasterioexMethod
GDALDatasetRasterIOEx(GDALDatasetH hDS,
                      GDALRWFlag eRWFlag,
                      int nXOff,
                      int nYOff,
                      int nXSize,
                      int nYSize,
                      void * pData,
                      int nBufXSize,
                      int nBufYSize,
                      GDALDataType eBufType,
                      int nBandCount,
                      int * panBandMap,
                      GSpacing nPixelSpace,
                      GSpacing nLineSpace,
                      GSpacing nBandSpace,
                      GDALRasterIOExtraArg * psExtraArg) -> CPLErr

Read/write a region of image data from multiple bands.

GDAL.gdaldatasetreadcompresseddataMethod
GDALDatasetReadCompressedData(GDALDatasetH hDS,
                              const char * pszFormat,
                              int nXOff,
                              int nYOff,
                              int nXSize,
                              int nYSize,
                              int nBandCount,
                              const int * panBandList,
                              void ** ppBuffer,
                              size_t * pnBufferSize,
                              char ** ppszDetailedFormat) -> CPLErr

Return the compressed content that can be natively obtained for the window of interest and requested bands.

Parameters

  • hDS: Dataset handle.
  • pszFormat: Requested compression format (e.g. "JPEG", "WEBP", "JXL"). This is the MIME type of one of the values returned by GetCompressionFormats(). The format string is designed to potentially include at a later point key=value optional parameters separated by a semi-colon character. At time of writing, none are implemented. ReadCompressedData() implementations should verify optional parameters and return CE_Failure if they cannot support one of them.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • nBandCount: the number of bands being requested.
  • panBandList: the list of nBandCount band numbers. Note band numbers are 1 based. This may be NULL to select the first nBandCount bands.
  • ppBuffer: Pointer to a buffer to store the compressed data or nullptr. If ppBuffer is not nullptr, then pnBufferSize should also not be nullptr. If ppBuffer is not nullptr, and *ppBuffer is not nullptr, then the provided buffer will be filled with the compressed data, provided that pnBufferSize and *pnBufferSize are not nullptr, and *pnBufferSize, indicating the size of *ppBuffer, is sufficiently large to hold the data. If ppBuffer is not nullptr, but *ppBuffer is nullptr, then the method will allocate *ppBuffer using VSIMalloc(), and thus the caller is responsible to free it with VSIFree(). If ppBuffer is nullptr, then the compressed data itself will not be returned, but *pnBufferSize will be updated with an upper bound of the size that would be necessary to hold it (if pnBufferSize != nullptr).
  • pnBufferSize: Output buffer size, or nullptr. If ppBuffer != nullptr && *ppBuffer != nullptr, then pnBufferSize should be != nullptr and *pnBufferSize contain the size of *ppBuffer. If the method is successful, *pnBufferSize will be updated with the actual size used.
  • ppszDetailedFormat: Pointer to an output string, or nullptr. If ppszDetailedFormat is not nullptr, then, on success, the method will allocate a new string in *ppszDetailedFormat (to be freed with VSIFree()) *ppszDetailedFormat might contain strings like "JPEG;frametype=SOF0baseline;bitdepth=8;numcomponents=3;" "subsampling=4:2:0;colorspace=YCbCr" or simply the MIME type. The string will contain at least as much information as what GetCompressionFormats() returns, and potentially more when ppBuffer != nullptr.

Returns

CENone in case of success, CEFailure otherwise.

GDAL.gdaldatasetreleaseresultsetMethod
GDALDatasetReleaseResultSet(GDALDatasetH hDS,
                            OGRLayerH hLayer) -> void

Release results of ExecuteSQL().

Parameters

  • hDS: the dataset handle.
  • hLayer: the result of a previous ExecuteSQL() call.
GDAL.gdaldatasetresetreadingMethod
GDALDatasetResetReading(GDALDatasetH hDS) -> void

Reset feature reading to start on the first feature.

Parameters

  • hDS: dataset handle
GDAL.gdaldatasetrollbacktransactionMethod
GDALDatasetRollbackTransaction(GDALDatasetH hDS) -> OGRErr

For datasources which support transactions, RollbackTransaction will roll back a datasource to its state before the start of the current transaction.

Returns

OGRERR_NONE on success.

GDAL.gdaldatasetsetqueryloggerfuncMethod
gdaldatasetsetqueryloggerfunc(hDS, pfnQueryLoggerFunc, poQueryLoggerArg)

Sets the SQL query logger callback.

When supported by the driver, the callback will be called with the executed SQL text, the error message, the execution time in milliseconds, the number of records fetched/affected and the client status data.

A value of -1 in the execution time or in the number of records indicates that the values are unknown.

\since GDAL 3.7

Parameters

  • hDS: Dataset handle.
  • pfnQueryLoggerFunc: Callback function
  • poQueryLoggerArg: Opaque client status data

Returns

true in case of success.

GDAL.gdaldatasetsetstyletableMethod
GDALDatasetSetStyleTable(GDALDatasetH hDS,
                         OGRStyleTableH hStyleTable) -> void

Set dataset style table.

Parameters

  • hDS: the dataset handle
  • hStyleTable: style table handle to set
GDAL.gdaldatasetsetstyletabledirectlyMethod
GDALDatasetSetStyleTableDirectly(GDALDatasetH hDS,
                                 OGRStyleTableH hStyleTable) -> void

Set dataset style table.

Parameters

  • hDS: the dataset handle
  • hStyleTable: style table handle to set
GDAL.gdaldatasetstarttransactionMethod
GDALDatasetStartTransaction(GDALDatasetH hDS,
                            int bForce) -> OGRErr

For datasources which support transactions, StartTransaction creates a transaction.

Parameters

  • hDS: the dataset handle.
  • bForce: can be set to TRUE if an emulation, possibly slow, of a transaction mechanism is acceptable.

Returns

OGRERR_NONE on success.

GDAL.gdaldatasettestcapabilityMethod
GDALDatasetTestCapability(GDALDatasetH hDS,
                          const char * pszCap) -> int

Test if capability is available.

Parameters

  • hDS: the dataset handle.
  • pszCap: the capability to test.

Returns

TRUE if capability available otherwise FALSE.

GDAL.gdaldatasetupdatefielddomainMethod
GDALDatasetUpdateFieldDomain(GDALDatasetH hDS,
                             OGRFieldDomainH hFieldDomain,
                             char ** ppszFailureReason) -> bool

Updates an existing field domain by replacing its definition.

Parameters

  • hDS: Dataset handle.
  • hFieldDomain: The domain definition. Contrary to the C++ version, the passed object is copied.
  • ppszFailureReason: Output parameter. Will contain an error message if an error occurs (*ppszFailureReason to be freed with CPLFree). May be NULL.

Returns

true in case of success.

GDAL.gdaldatasetupdaterelationshipMethod
GDALDatasetUpdateRelationship(GDALDatasetH hDS,
                              GDALRelationshipH hRelationship,
                              char ** ppszFailureReason) -> bool

Updates an existing relationship by replacing its definition.

Parameters

  • hDS: Dataset handle.
  • hRelationship: The relationship definition. Contrary to the C++ version, the passed object is copied.
  • ppszFailureReason: Output parameter. Will contain an error message if an error occurs (*ppszFailureReason to be freed with CPLFree). May be NULL.

Returns

true in case of success.

GDAL.gdaldatatypeiscomplexMethod
GDALDataTypeIsComplex(GDALDataType eDataType) -> int

Is data type complex?

Returns

TRUE if the passed type is complex (one of GDTCInt16, GDTCInt32, GDTCFloat32 or GDTCFloat64), that is it consists of a real and imaginary component.

GDAL.gdaldatatypeisconversionlossyMethod
GDALDataTypeIsConversionLossy(GDALDataType eTypeFrom,
                              GDALDataType eTypeTo) -> int

Is conversion from eTypeFrom to eTypeTo potentially lossy.

Parameters

  • eTypeFrom: input datatype
  • eTypeTo: output datatype

Returns

TRUE if conversion from eTypeFrom to eTypeTo potentially lossy.

GDAL.gdaldatatypeisfloatingMethod
GDALDataTypeIsFloating(GDALDataType eDataType) -> int

Is data type floating? (might be complex)

Returns

TRUE if the passed type is floating (one of GDTFloat32, GDTFloat64, GDTCFloat32, GDTCFloat64)

GDAL.gdaldatatypeisintegerMethod
GDALDataTypeIsInteger(GDALDataType eDataType) -> int

Is data type integer? (might be complex)

Returns

TRUE if the passed type is integer (one of GDTByte, GDTInt16, GDTUInt16, GDTInt32, GDTUInt32, GDTCInt16, GDT_CInt32).

GDAL.gdaldatatypeissignedMethod
GDALDataTypeIsSigned(GDALDataType eDataType) -> int

Is data type signed?

Returns

TRUE if the passed type is signed.

GDAL.gdaldatatypeunionMethod
GDALDataTypeUnion(GDALDataType eType1,
                  GDALDataType eType2) -> GDALDataType

Return the smallest data type that can fully express both input data types.

Parameters

  • eType1: first data type.
  • eType2: second data type.

Returns

a data type able to express eType1 and eType2.

GDAL.gdaldatatypeunionwithvalueMethod
GDALDataTypeUnionWithValue(GDALDataType eDT,
                           double dValue,
                           int bComplex) -> GDALDataType

Union a data type with the one found for a value.

Parameters

  • eDT: the first data type
  • dValue: the value for which to find a data type and union with eDT
  • bComplex: if the value is complex

Returns

a data type able to express eDT and dValue.

GDAL.gdaldectodmsMethod
GDALDecToDMS(double dfAngle,
             const char * pszAxis,
             int nPrecision) -> const char *

Translate a decimal degrees value to a DMS string with hemisphere.

GDAL.gdaldectopackeddmsMethod
GDALDecToPackedDMS(double dfDec) -> double

Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).

GDAL.gdaldeinitgcpsMethod
GDALDeinitGCPs(int nCount,
               GDAL_GCP * psGCP) -> void

De-initialize an array of GCPs (initialized with GDALInitGCPs())

Parameters

  • nCount: number of GCPs in psGCP
  • psGCP: array of GCPs of size nCount.
GDAL.gdaldeinterleaveMethod
GDALDeinterleave(const void * pSourceBuffer,
                 GDALDataType eSourceDT,
                 int nComponents,
                 void ** ppDestBuffer,
                 GDALDataType eDestDT,
                 size_t nIters) -> void
GDAL.gdaldeletedatasetMethod
GDALDeleteDataset(GDALDriverH hDriver,
                  const char * pszFilename) -> CPLErr

Delete named dataset.

GDAL.gdaldemprocessingMethod
GDALDEMProcessing(const char * pszDest,
                  GDALDatasetH hSrcDataset,
                  const char * pszProcessing,
                  const char * pszColorFilename,
                  const GDALDEMProcessingOptions * psOptionsIn,
                  int * pbUsageError) -> GDALDatasetH

Apply a DEM processing.

Parameters

  • pszDest: the destination dataset path.
  • hSrcDataset: the source dataset handle.
  • pszProcessing: the processing to apply (one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness")
  • pszColorFilename: color file (mandatory for "color-relief" processing, should be NULL otherwise)
  • psOptionsIn: the options struct returned by GDALDEMProcessingOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose()) or NULL in case of error.

GDAL.gdaldemprocessingoptionsfreeMethod
GDALDEMProcessingOptionsFree(GDALDEMProcessingOptions * psOptions) -> void

Frees the GDALDEMProcessingOptions struct.

Parameters

  • psOptions: the options struct for GDALDEMProcessing().
GDAL.gdaldemprocessingoptionsnewMethod
GDALDEMProcessingOptionsNew(char ** papszArgv,
                            GDALDEMProcessingOptionsForBinary * psOptionsForBinary) -> GDALDEMProcessingOptions *

Allocates a GDALDEMProcessingOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdaldem utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALDEMProcessingOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALDEMProcessingOptions struct. Must be freed with GDALDEMProcessingOptionsFree().

GDAL.gdaldemprocessingoptionssetprogressMethod
GDALDEMProcessingOptionsSetProgress(GDALDEMProcessingOptions * psOptions,
                                    GDALProgressFunc pfnProgress,
                                    void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALDEMProcessing().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdaldeserializetransformerMethod
GDALDeserializeTransformer(CPLXMLNode * psTree,
                           GDALTransformerFunc * ppfnFunc,
                           void ** ppTransformArg) -> CPLErr
GDAL.gdaldestroyapproxtransformerMethod
GDALDestroyApproxTransformer(void * pCBData) -> void

Cleanup approximate transformer.

Parameters

  • pCBData: callback data originally returned by GDALCreateApproxTransformer().
GDAL.gdaldestroydriverMethod
GDALDestroyDriver(GDALDriverH hDriver) -> void

Destroy a GDALDriver.

Parameters

  • hDriver: the driver to destroy.
GDAL.gdaldestroygcptransformerMethod
GDALDestroyGCPTransformer(void * pTransformArg) -> void

Destroy GCP transformer.

Parameters

  • pTransformArg: the transform arg previously returned by GDALCreateGCPTransformer().
GDAL.gdaldestroygenimgprojtransformerMethod
GDALDestroyGenImgProjTransformer(void * hTransformArg) -> void

GenImgProjTransformer deallocator.

Parameters

  • hTransformArg: the handle to deallocate.
GDAL.gdaldestroyreprojectiontransformerMethod
GDALDestroyReprojectionTransformer(void * pTransformArg) -> void

Destroy reprojection transformation.

Parameters

  • pTransformArg: the transformation handle returned by GDALCreateReprojectionTransformer().
GDAL.gdaldestroyscaledprogressMethod
GDALDestroyScaledProgress(void * pData) -> void

Cleanup scaled progress handle.

Parameters

  • pData: scaled progress handle returned by GDALCreateScaledProgress().
GDAL.gdaldestroytpstransformerMethod
GDALDestroyTPSTransformer(void * pTransformArg) -> void

Destroy TPS transformer.

Parameters

  • pTransformArg: the transform arg previously returned by GDALCreateTPSTransformer().
GDAL.gdaldimensiongetindexingvariableMethod
GDALDimensionGetIndexingVariable(GDALDimensionH hDim) -> GDALMDArrayH

Return the variable that is used to index the dimension (if there is one).

GDAL.gdaldimensiongetsizeMethod
GDALDimensionGetSize(GDALDimensionH hDim) -> GUInt64

Return the size, that is the number of values along the dimension.

GDAL.gdaldimensionreleaseMethod
GDALDimensionRelease(GDALDimensionH hDim) -> void

Release the GDAL in-memory object associated with a GDALDimension.

GDAL.gdaldimensionsetindexingvariableMethod
GDALDimensionSetIndexingVariable(GDALDimensionH hDim,
                                 GDALMDArrayH hArray) -> int

Set the variable that is used to index the dimension.

Returns

TRUE in case of success.

GDAL.gdalditherrgb2pctMethod
GDALDitherRGB2PCT(GDALRasterBandH hRed,
                  GDALRasterBandH hGreen,
                  GDALRasterBandH hBlue,
                  GDALRasterBandH hTarget,
                  GDALColorTableH hColorTable,
                  GDALProgressFunc pfnProgress,
                  void * pProgressArg) -> int

24bit to 8bit conversion with dithering.

Parameters

  • hRed: Red input band.
  • hGreen: Green input band.
  • hBlue: Blue input band.
  • hTarget: Output band.
  • hColorTable: the color table to use with the output band.
  • pfnProgress: callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
  • pProgressArg: callback argument passed to pfnProgress.

Returns

CENone on success or CEFailure if an error occurs.

GDAL.gdaldummyprogressMethod
GDALDummyProgress(double,
                  const char *,
                  void *) -> int

Stub progress function.

GDAL.gdalduplicategcpsMethod
GDALDuplicateGCPs(int nCount,
                  const GDAL_GCP * pasGCPList) -> GDAL_GCP *

Duplicate an array of GCPs.

Parameters

  • nCount: number of GCPs in psGCP
  • pasGCPList: array of GCPs of size nCount.
GDAL.gdaledtcomponentcreateMethod
GDALEDTComponentCreate(const char * pszName,
                       size_t nOffset,
                       GDALExtendedDataTypeH hType) -> GDALEDTComponentH

Create a new GDALEDTComponent.

GDAL.gdaledtcomponentgetoffsetMethod
GDALEDTComponentGetOffset(GDALEDTComponentH hComp) -> size_t

Return the offset (in bytes) of the component in the compound data type.

GDAL.gdaledtcomponentgettypeMethod
GDALEDTComponentGetType(GDALEDTComponentH hComp) -> GDALExtendedDataTypeH

Return the data type of the component.

GDAL.gdaledtcomponentreleaseMethod
GDALEDTComponentRelease(GDALEDTComponentH hComp) -> void

Release the GDAL in-memory object associated with a GDALEDTComponentH.

GDAL.gdalendasyncreaderMethod
GDALEndAsyncReader(GDALDatasetH hDS,
                   GDALAsyncReaderH hAsyncReaderH) -> void

End asynchronous request.

Parameters

  • hDS: handle to the dataset object.
  • hAsyncReaderH: handle returned by GDALBeginAsyncReader()
GDAL.gdalextendeddatatypecanconverttoMethod
GDALExtendedDataTypeCanConvertTo(GDALExtendedDataTypeH hSourceEDT,
                                 GDALExtendedDataTypeH hTargetEDT) -> int

Return whether this data type can be converted to the other one.

Parameters

  • hSourceEDT: Source data type for the conversion being considered.
  • hTargetEDT: Target data type for the conversion being considered.

Returns

TRUE if hSourceEDT can be convert to hTargetEDT. FALSE otherwise.

GDAL.gdalextendeddatatypecreateMethod
GDALExtendedDataTypeCreate(GDALDataType eType) -> GDALExtendedDataTypeH

Return a new GDALExtendedDataType of class GEDTC_NUMERIC.

Parameters

  • eType: Numeric data type.

Returns

a new GDALExtendedDataTypeH handle, or nullptr.

GDAL.gdalextendeddatatypecreatecompoundMethod
GDALExtendedDataTypeCreateCompound(const char * pszName,
                                   size_t nTotalSize,
                                   size_t nComponents,
                                   const GDALEDTComponentH * comps) -> GDALExtendedDataTypeH

Return a new GDALExtendedDataType of class GEDTC_COMPOUND.

Parameters

  • pszName: Type name.
  • nTotalSize: Total size of the type in bytes. Should be large enough to store all components.
  • nComponents: Number of components in comps array.
  • comps: Components.

Returns

a new GDALExtendedDataTypeH handle, or nullptr.

GDAL.gdalextendeddatatypecreatestringMethod
GDALExtendedDataTypeCreateString(size_t nMaxStringLength) -> GDALExtendedDataTypeH

Return a new GDALExtendedDataType of class GEDTC_STRING.

Returns

a new GDALExtendedDataTypeH handle, or nullptr.

GDAL.gdalextendeddatatypecreatestringexMethod
GDALExtendedDataTypeCreateStringEx(size_t nMaxStringLength,
                                   GDALExtendedDataTypeSubType eSubType) -> GDALExtendedDataTypeH

Return a new GDALExtendedDataType of class GEDTC_STRING.

Returns

a new GDALExtendedDataTypeH handle, or nullptr.

GDAL.gdalextendeddatatypeequalsMethod
GDALExtendedDataTypeEquals(GDALExtendedDataTypeH hFirstEDT,
                           GDALExtendedDataTypeH hSecondEDT) -> int

Return whether this data type is equal to another one.

Parameters

  • hFirstEDT: First data type.
  • hSecondEDT: Second data type.

Returns

TRUE if they are equal. FALSE otherwise.

GDAL.gdalextendeddatatypefreecomponentsMethod
GDALExtendedDataTypeFreeComponents(GDALEDTComponentH * components,
                                   size_t nCount) -> void

Free the return of GDALExtendedDataTypeGetComponents().

Parameters

  • components: return value of GDALExtendedDataTypeGetComponents()
  • nCount: *pnCount value returned by GDALExtendedDataTypeGetComponents()
GDAL.gdalextendeddatatypegetcomponentsMethod
GDALExtendedDataTypeGetComponents(GDALExtendedDataTypeH hEDT,
                                  size_t * pnCount) -> GDALEDTComponentH *

Return the components of the data type (only valid when GetClass() == GEDTC_COMPOUND)

Parameters

  • hEDT: Data type
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.

Returns

an array of *pnCount components.

GDAL.gdalextendeddatatypegetsubtypeMethod
GDALExtendedDataTypeGetSubType(GDALExtendedDataTypeH hEDT) -> GDALExtendedDataTypeSubType

Return the subtype of a type.

Parameters

  • hEDT: Data type.

Returns

subtype.

GDAL.gdalextendeddatatypereleaseMethod
GDALExtendedDataTypeRelease(GDALExtendedDataTypeH hEDT) -> void

Release the GDAL in-memory object associated with a GDALExtendedDataTypeH.

GDAL.gdalfillnodataMethod
GDALFillNodata(GDALRasterBandH hTargetBand,
               GDALRasterBandH hMaskBand,
               double dfMaxSearchDist,
               int bDeprecatedOption,
               int nSmoothingIterations,
               char ** papszOptions,
               GDALProgressFunc pfnProgress,
               void * pProgressArg) -> CPLErr

Fill selected raster regions by interpolation from the edges.

Parameters

  • hTargetBand: the raster band to be modified in place.
  • hMaskBand: a mask band indicating pixels to be interpolated (zero valued). If hMaskBand is set to NULL, this method will internally use the mask band returned by GDALGetMaskBand(hTargetBand).
  • dfMaxSearchDist: the maximum number of pixels to search in all directions to find values to interpolate from.
  • bDeprecatedOption: unused argument, should be zero.
  • nSmoothingIterations: the number of 3x3 smoothing filter passes to run (0 or more).
  • papszOptions: additional name=value options in a string list.

TEMPFILEDRIVER=gdaldrivername. For example MEM.

NODATA=value (starting with GDAL 2.4). Source pixels at that value will be ignored by the interpolator. Warning: currently this will not be honored by smoothing passes.

  • pfnProgress: the progress function to report completion.
  • pProgressArg: callback data for progress function.

Returns

CENone on success or CEFailure if something goes wrong.

GDAL.gdalfillrasterMethod
GDALFillRaster(GDALRasterBandH hBand,
               double dfRealValue,
               double dfImaginaryValue) -> CPLErr

Fill this band with a constant value.

GDAL.gdalfinddatatypeMethod
GDALFindDataType(int nBits,
                 int bSigned,
                 int bFloating,
                 int bComplex) -> GDALDataType

Finds the smallest data type able to support the given requirements.

Parameters

  • nBits: number of bits necessary
  • bSigned: if negative values are necessary
  • bFloating: if non-integer values necessary
  • bComplex: if complex values are necessary

Returns

a best fit GDALDataType for supporting the requirements

GDAL.gdalfinddatatypeforvalueMethod
GDALFindDataTypeForValue(double dValue,
                         int bComplex) -> GDALDataType

Finds the smallest data type able to support the provided value.

Parameters

  • dValue: value to support
  • bComplex: is the value complex

Returns

a best fit GDALDataType for supporting the value

GDAL.gdalflushcacheMethod
GDALFlushCache(GDALDatasetH hDS) -> CPLErr

Flush all write cached data to disk.

Returns

CE_None in case of success (note: return value added in GDAL 3.7)

GDAL.gdalflushcacheblockMethod
GDALFlushCacheBlock() -> int

Try to flush one cached raster block.

Returns

TRUE if one block was flushed, FALSE if there are no cached blocks or if they are currently locked.

GDAL.gdalfpolygonizeMethod
GDALFPolygonize(GDALRasterBandH hSrcBand,
                GDALRasterBandH hMaskBand,
                OGRLayerH hOutLayer,
                int iPixValField,
                char ** papszOptions,
                GDALProgressFunc pfnProgress,
                void * pProgressArg) -> CPLErr

Create polygon coverage from raster data.

Parameters

  • hSrcBand: the source raster band to be processed.
  • hMaskBand: an optional mask band. All pixels in the mask band with a value other than zero will be considered suitable for collection as polygons.
  • hOutLayer: the vector feature layer to which the polygons should be written.
  • iPixValField: the attribute field index indicating the feature attribute into which the pixel value of the polygon should be written. Or -1 to indicate that the pixel value must not be written.
  • papszOptions: a name/value list of additional options

8CONNECTED=8: May be set to "8" to use 8 connectedness. Otherwise 4 connectedness will be applied to the algorithm

DATASETFORGEOREF=dataset_name: Name of a dataset from which to read the geotransform. This useful if hSrcBand has no related dataset, which is typical for mask bands.

  • pfnProgress: callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
  • pProgressArg: callback argument passed to pfnProgress.

Returns

CENone on success or CEFailure on a failure.

GDAL.gdalgcpstogeotransformMethod
GDALGCPsToGeoTransform(int nGCPCount,
                       const GDAL_GCP * pasGCPs,
                       double * padfGeoTransform,
                       int bApproxOK) -> int

Generate Geotransform from GCPs.

Parameters

  • nGCPCount: the number of GCPs being passed in.
  • pasGCPs: the list of GCP structures.
  • padfGeoTransform: the six double array in which the affine geotransformation will be returned.
  • bApproxOK: If FALSE the function will fail if the geotransform is not essentially an exact fit (within 0.25 pixel) for all GCPs.

Returns

TRUE on success or FALSE if there aren't enough points to prepare a geotransform, the pointers are ill-determined or if bApproxOK is FALSE and the fit is poor.

GDAL.gdalgcptransformMethod
GDALGCPTransform(void * pTransformArg,
                 int bDstToSrc,
                 int nPointCount,
                 double * x,
                 double * y,
                 double * z,
                 int * panSuccess) -> int

Transforms point based on GCP derived polynomial model.

Parameters

  • pTransformArg: return value from GDALCreateGCPTransformer().
  • bDstToSrc: TRUE if transformation is from the destination (georeferenced) coordinates to pixel/line or FALSE when transforming from pixel/line to georeferenced coordinates.
  • nPointCount: the number of values in the x, y and z arrays.
  • x: array containing the X values to be transformed.
  • y: array containing the Y values to be transformed.
  • z: array containing the Z values to be transformed.
  • panSuccess: array in which a flag indicating success (TRUE) or failure (FALSE) of the transformation are placed.

Returns

TRUE.

GDAL.gdalgeneralcmdlineprocessorMethod
GDALGeneralCmdLineProcessor(int nArgc,
                            char *** ppapszArgv,
                            int nOptions) -> int

General utility option processing.

Parameters

  • nArgc: number of values in the argument list.
  • ppapszArgv: pointer to the argument list array (will be updated in place).
  • nOptions: a or-able combination of GDALOFRASTER and GDALOFVECTOR to determine which drivers should be displayed by formats. If set to 0, GDALOFRASTER is assumed.

Returns

updated nArgc argument count. Return of 0 requests terminate without error, return of -1 requests exit with error code.

GDAL.gdalgenimgprojtransformMethod
GDALGenImgProjTransform(void * pTransformArgIn,
                        int bDstToSrc,
                        int nPointCount,
                        double * padfX,
                        double * padfY,
                        double * padfZ,
                        int * panSuccess) -> int

Perform general image reprojection transformation.

GDAL.gdalgeoloctransformMethod
GDALGeoLocTransform(void * pTransformArg,
                    int bDstToSrc,
                    int nPointCount,
                    double * padfX,
                    double * padfY,
                    double * padfZ,
                    int * panSuccess) -> int

Use GeoLocation transformer.

GDAL.gdalgetactualblocksizeMethod
GDALGetActualBlockSize(GDALRasterBandH hBand,
                       int nXBlockOff,
                       int nYBlockOff,
                       int * pnXValid,
                       int * pnYValid) -> CPLErr

Retrieve the actual block size for a given block offset.

GDAL.gdalgetasyncstatustypebynameMethod
GDALGetAsyncStatusTypeByName(const char * pszName) -> GDALAsyncStatusType

Get AsyncStatusType by symbolic name.

Parameters

  • pszName: string containing the symbolic name of the type.

Returns

GDAL AsyncStatus type.

GDAL.gdalgetasyncstatustypenameMethod
GDALGetAsyncStatusTypeName(GDALAsyncStatusType eAsyncStatusType) -> const char *

Get name of AsyncStatus data type.

Parameters

  • eAsyncStatusType: type to get name of.

Returns

string corresponding to type.

GDAL.gdalgetbanddatasetMethod
GDALGetBandDataset(GDALRasterBandH hBand) -> GDALDatasetH

Fetch the owning dataset handle.

GDAL.gdalgetblocksizeMethod
GDALGetBlockSize(GDALRasterBandH hBand,
                 int * pnXSize,
                 int * pnYSize) -> void

Fetch the "natural" block size of this band.

GDAL.gdalgetcachemaxMethod
GDALGetCacheMax() -> int

Get maximum cache memory.

Returns

maximum in bytes.

GDAL.gdalgetcachemax64Method
GDALGetCacheMax64() -> GIntBig

Get maximum cache memory.

Returns

maximum in bytes.

GDAL.gdalgetcacheusedMethod
GDALGetCacheUsed() -> int

Get cache memory used.

Returns

the number of bytes of memory currently in use by the GDALRasterBlock memory caching.

GDAL.gdalgetcacheused64Method
GDALGetCacheUsed64() -> GIntBig

Get cache memory used.

Returns

the number of bytes of memory currently in use by the GDALRasterBlock memory caching.

GDAL.gdalgetcolorentryMethod
GDALGetColorEntry(GDALColorTableH hTable,
                  int i) -> const GDALColorEntry *

Fetch a color entry from table.

GDAL.gdalgetcolorentryasrgbMethod
GDALGetColorEntryAsRGB(GDALColorTableH hTable,
                       int i,
                       GDALColorEntry * poEntry) -> int

Fetch a table entry in RGB format.

GDAL.gdalgetcolorinterpretationbynameMethod
GDALGetColorInterpretationByName(const char * pszName) -> GDALColorInterp

Get color interpretation by symbolic name.

Parameters

  • pszName: string containing the symbolic name of the color interpretation.

Returns

GDAL color interpretation.

GDAL.gdalgetcolorinterpretationnameMethod
GDALGetColorInterpretationName(GDALColorInterp eInterp) -> const char *

Get name of color interpretation.

Parameters

  • eInterp: color interpretation to get name of.

Returns

string corresponding to color interpretation or NULL pointer if invalid enumerator given.

GDAL.gdalgetdatacoveragestatusMethod
GDALGetDataCoverageStatus(GDALRasterBandH hBand,
                          int nXOff,
                          int nYOff,
                          int nXSize,
                          int nYSize,
                          int nMaskFlagStop,
                          double * pdfDataPct) -> int

Get the coverage status of a sub-window of the raster.

Parameters

  • hBand: raster band
  • nXOff: The pixel offset to the top left corner of the region of the band to be queried. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be queried. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be queried in pixels.
  • nYSize: The height of the region of the band to be queried in lines.
  • nMaskFlagStop: 0, or a binary-or'ed mask of possible values GDALDATACOVERAGESTATUSUNIMPLEMENTED, GDALDATACOVERAGESTATUSDATA and GDALDATACOVERAGESTATUSEMPTY. As soon as the computation of the coverage matches the mask, the computation will be stopped. *pdfDataPct will not be valid in that case.
  • pdfDataPct: Optional output parameter whose pointed value will be set to the (approximate) percentage in [0,100] of pixels in the queried sub-window that have valid values. The implementation might not always be able to compute it, in which case it will be set to a negative value.

Returns

a binary-or'ed combination of possible values GDALDATACOVERAGESTATUSUNIMPLEMENTED, GDALDATACOVERAGESTATUSDATA and GDALDATACOVERAGESTATUSEMPTY

GDAL.gdalgetdatasetdriverMethod
GDALGetDatasetDriver(GDALDatasetH hDataset) -> GDALDriverH

Fetch the driver to which this dataset relates.

GDAL.gdalgetdatatypebynameMethod
GDALGetDataTypeByName(const char * pszName) -> GDALDataType

Get data type by symbolic name.

Parameters

  • pszName: string containing the symbolic name of the type.

Returns

GDAL data type.

GDAL.gdalgetdatatypenameMethod
GDALGetDataTypeName(GDALDataType eDataType) -> const char *

Get name of data type.

Parameters

  • eDataType: type to get name of.

Returns

string corresponding to existing data type or NULL pointer if invalid type given.

GDAL.gdalgetdatatypesizeMethod
GDALGetDataTypeSize(GDALDataType eDataType) -> int

Get data type size in bits.

Parameters

  • eDataType: type, such as GDT_Byte.

Returns

the number of bits or zero if it is not recognised.

GDAL.gdalgetdatatypesizebitsMethod
GDALGetDataTypeSizeBits(GDALDataType eDataType) -> int

Get data type size in bits.

Parameters

  • eDataType: type, such as GDT_Byte.

Returns

the number of bits or zero if it is not recognised.

GDAL.gdalgetdatatypesizebytesMethod
GDALGetDataTypeSizeBytes(GDALDataType eDataType) -> int

Get data type size in bytes.

Parameters

  • eDataType: type, such as GDT_Byte.

Returns

the number of bytes or zero if it is not recognised.

GDAL.gdalgetdefaulthistogramMethod
GDALGetDefaultHistogram(GDALRasterBandH hBand,
                        double * pdfMin,
                        double * pdfMax,
                        int * pnBuckets,
                        int ** ppanHistogram,
                        int bForce,
                        GDALProgressFunc pfnProgress,
                        void * pProgressData) -> CPLErr

Fetch default raster histogram.

GDAL.gdalgetdefaulthistogramexMethod
GDALGetDefaultHistogramEx(GDALRasterBandH hBand,
                          double * pdfMin,
                          double * pdfMax,
                          int * pnBuckets,
                          GUIntBig ** ppanHistogram,
                          int bForce,
                          GDALProgressFunc pfnProgress,
                          void * pProgressData) -> CPLErr

Fetch default raster histogram.

GDAL.gdalgetdefaultratMethod
GDALGetDefaultRAT(GDALRasterBandH hBand) -> GDALRasterAttributeTableH

Fetch default Raster Attribute Table.

GDAL.gdalgetdescriptionMethod
GDALGetDescription(GDALMajorObjectH hObject) -> const char *

Fetch object description.

GDAL.gdalgetdriverMethod
GDALGetDriver(int iDriver) -> GDALDriverH

Fetch driver by index.

GDAL.gdalgetdriverbynameMethod
GDALGetDriverByName(const char * pszName) -> GDALDriverH

Fetch a driver based on the short name.

GDAL.gdalgetdrivercreationoptionlistMethod
GDALGetDriverCreationOptionList(GDALDriverH hDriver) -> const char *

Return the list of creation options of the driver.

Parameters

  • hDriver: the handle of the driver

Returns

an XML string that describes the list of creation options or empty string. The returned string should not be freed and is owned by the driver.

GDAL.gdalgetdriverhelptopicMethod
GDALGetDriverHelpTopic(GDALDriverH hDriver) -> const char *

Return the URL to the help that describes the driver.

Parameters

  • hDriver: the handle of the driver

Returns

the URL to the help that describes the driver or NULL. The returned string should not be freed and is owned by the driver.

GDAL.gdalgetdriverlongnameMethod
GDALGetDriverLongName(GDALDriverH hDriver) -> const char *

Return the long name of a driver.

Parameters

  • hDriver: the handle of the driver

Returns

the long name of the driver or empty string. The returned string should not be freed and is owned by the driver.

GDAL.gdalgetdrivershortnameMethod
GDALGetDriverShortName(GDALDriverH hDriver) -> const char *

Return the short name of a driver.

Parameters

  • hDriver: the handle of the driver

Returns

the short name of the driver. The returned string should not be freed and is owned by the driver.

GDAL.gdalgetfilelistMethod
GDALGetFileList(GDALDatasetH hDS) -> char **

Fetch files forming dataset.

GDAL.gdalgetgcpsMethod
GDALGetGCPs(GDALDatasetH hDS) -> const GDAL_GCP *

Fetch GCPs.

GDAL.gdalgetgcpspatialrefMethod
GDALGetGCPSpatialRef(GDALDatasetH hDS) -> OGRSpatialReferenceH

Get output spatial reference system for GCPs.

GDAL.gdalgetgeotransformMethod
GDALGetGeoTransform(GDALDatasetH hDS,
                    double * padfTransform) -> CPLErr

Fetch the affine transformation coefficients.

GDAL.gdalgetinternalhandleMethod
GDALGetInternalHandle(GDALDatasetH hDS,
                      const char * pszRequest) -> void *

Fetch a format specific internally meaningful handle.

GDAL.gdalgetjpeg2000structureMethod
GDALGetJPEG2000Structure(const char * pszFilename,
                         CSLConstList papszOptions) -> CPLXMLNode *

Dump the structure of a JPEG2000 file as a XML tree.

Parameters

  • pszFilename: filename.
  • papszOptions: NULL terminated list of options, or NULL. Allowed options are BINARYCONTENT=YES, TEXTCONTENT=YES, CODESTREAM=YES, ALL=YES, JP2BOXES=YES, CODESTREAMMARKERS=listofmarkernamescommaseparated, STOPATSOD=YES, ALLOWGETFILESIZE=NO.

Returns

XML tree (to be freed with CPLDestroyXMLNode()) or NULL in case of error

GDAL.gdalgetmaskbandMethod
GDALGetMaskBand(GDALRasterBandH hBand) -> GDALRasterBandH

Return the mask band associated with the band.

GDAL.gdalgetmaskflagsMethod
GDALGetMaskFlags(GDALRasterBandH hBand) -> int

Return the status flags of the mask band associated with the band.

GDAL.gdalgetmetadataMethod
GDALGetMetadata(GDALMajorObjectH hObject,
                const char * pszDomain) -> char **

Fetch metadata.

GDAL.gdalgetmetadataitemMethod
GDALGetMetadataItem(GDALMajorObjectH hObject,
                    const char * pszName,
                    const char * pszDomain) -> const char *

Fetch single metadata item.

GDAL.gdalgetnoncomplexdatatypeMethod
GDALGetNonComplexDataType(GDALDataType eDataType) -> GDALDataType

Return the base data type for the specified input.

Parameters

  • eDataType: type, such as GDT_CFloat32.

Returns

GDAL data type.

GDAL.gdalgetopendatasetsMethod
GDALGetOpenDatasets(GDALDatasetH ** ppahDSList,
                    int * pnCount) -> void

Fetch all open GDAL dataset handles.

GDAL.gdalgetoverviewMethod
GDALGetOverview(GDALRasterBandH hBand,
                int i) -> GDALRasterBandH

Fetch overview raster band object.

GDAL.gdalgetoverviewcountMethod
GDALGetOverviewCount(GDALRasterBandH hBand) -> int

Return the number of overview layers available.

GDAL.gdalgetpaletteinterpretationnameMethod
GDALGetPaletteInterpretationName(GDALPaletteInterp eInterp) -> const char *

Get name of palette interpretation.

Parameters

  • eInterp: palette interpretation to get name of.

Returns

string corresponding to palette interpretation.

GDAL.gdalgetprojectionrefMethod
GDALGetProjectionRef(GDALDatasetH hDS) -> const char *

Fetch the projection definition string for this dataset.

GDAL.gdalgetrandomrastersampleMethod
GDALGetRandomRasterSample(GDALRasterBandH hBand,
                          int nSamples,
                          float * pafSampleBuf) -> int

Undocumented.

Parameters

  • hBand: undocumented.
  • nSamples: undocumented.
  • pafSampleBuf: undocumented.

Returns

undocumented

GDAL.gdalgetrasteraccessMethod
GDALGetRasterAccess(GDALRasterBandH hBand) -> GDALAccess

Find out if we have update permission for this band.

GDAL.gdalgetrasterbandMethod
GDALGetRasterBand(GDALDatasetH hDS,
                  int nBandId) -> GDALRasterBandH

Fetch a band object for a dataset.

GDAL.gdalgetrastercolortableMethod
GDALGetRasterColorTable(GDALRasterBandH hBand) -> GDALColorTableH

Fetch the color table associated with band.

GDAL.gdalgetrastercountMethod
GDALGetRasterCount(GDALDatasetH hDS) -> int

Fetch the number of raster bands on this dataset.

GDAL.gdalgetrasterdatatypeMethod
GDALGetRasterDataType(GDALRasterBandH hBand) -> GDALDataType

Fetch the pixel data type for this band.

GDAL.gdalgetrasterhistogramMethod
GDALGetRasterHistogram(GDALRasterBandH hBand,
                       double dfMin,
                       double dfMax,
                       int nBuckets,
                       int * panHistogram,
                       int bIncludeOutOfRange,
                       int bApproxOK,
                       GDALProgressFunc pfnProgress,
                       void * pProgressData) -> CPLErr

Compute raster histogram.

GDAL.gdalgetrasterhistogramexMethod
GDALGetRasterHistogramEx(GDALRasterBandH hBand,
                         double dfMin,
                         double dfMax,
                         int nBuckets,
                         GUIntBig * panHistogram,
                         int bIncludeOutOfRange,
                         int bApproxOK,
                         GDALProgressFunc pfnProgress,
                         void * pProgressData) -> CPLErr

Compute raster histogram.

GDAL.gdalgetrastermaximumMethod
GDALGetRasterMaximum(GDALRasterBandH hBand,
                     int * pbSuccess) -> double

Fetch the maximum value for this band.

GDAL.gdalgetrasterminimumMethod
GDALGetRasterMinimum(GDALRasterBandH hBand,
                     int * pbSuccess) -> double

Fetch the minimum value for this band.

GDAL.gdalgetrasternodatavalueMethod
GDALGetRasterNoDataValue(GDALRasterBandH hBand,
                         int * pbSuccess) -> double

Fetch the no data value for this band.

GDAL.gdalgetrasteroffsetMethod
GDALGetRasterOffset(GDALRasterBandH hBand,
                    int * pbSuccess) -> double

Fetch the raster value offset.

GDAL.gdalgetrastersampleoverviewMethod
GDALGetRasterSampleOverview(GDALRasterBandH hBand,
                            int nDesiredSamples) -> GDALRasterBandH

Fetch best sampling overview.

GDAL.gdalgetrastersampleoverviewexMethod
GDALGetRasterSampleOverviewEx(GDALRasterBandH hBand,
                              GUIntBig nDesiredSamples) -> GDALRasterBandH

Fetch best sampling overview.

GDAL.gdalgetrasterscaleMethod
GDALGetRasterScale(GDALRasterBandH hBand,
                   int * pbSuccess) -> double

Fetch the raster value scale.

GDAL.gdalgetrasterstatisticsMethod
GDALGetRasterStatistics(GDALRasterBandH hBand,
                        int bApproxOK,
                        int bForce,
                        double * pdfMin,
                        double * pdfMax,
                        double * pdfMean,
                        double * pdfStdDev) -> CPLErr

Fetch image statistics.

GDAL.gdalgetspatialrefMethod
GDALGetSpatialRef(GDALDatasetH hDS) -> OGRSpatialReferenceH

Fetch the spatial reference for this dataset.

GDAL.gdalgettransformerdstgeotransformMethod
GDALGetTransformerDstGeoTransform(void * pTransformArg,
                                  double * padfGeoTransform) -> void

Get ApproxTransformer or GenImgProj output geotransform.

Parameters

  • pTransformArg: transformer handle.
  • padfGeoTransform: (output) the destination geotransform to return (six doubles).
GDAL.gdalgetvirtualmemautoMethod
GDALGetVirtualMemAuto(GDALRasterBandH hBand,
                      GDALRWFlag eRWFlag,
                      int * pnPixelSpace,
                      GIntBig * pnLineSpace,
                      CSLConstList papszOptions) -> CPLVirtualMem *

Create a CPLVirtualMem object from a GDAL raster band object.

GDAL.gdalgridMethod
GDALGrid(const char * pszDest,
         GDALDatasetH hSrcDataset,
         const GDALGridOptions * psOptionsIn,
         int * pbUsageError) -> GDALDatasetH

Create raster from the scattered data.

Parameters

  • pszDest: the destination dataset path.
  • hSrcDataset: the source dataset handle.
  • psOptionsIn: the options struct returned by GDALGridOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose()) or NULL in case of error.

GDAL.gdalgridcontextcreateMethod
GDALGridContextCreate(GDALGridAlgorithm eAlgorithm,
                      const void * poOptions,
                      GUInt32 nPoints,
                      const double * padfX,
                      const double * padfY,
                      const double * padfZ,
                      int bCallerWillKeepPointArraysAlive) -> GDALGridContext *

Creates a context to do regular gridding from the scattered data.

Parameters

  • eAlgorithm: Gridding method.
  • poOptions: Options to control chosen gridding method.
  • nPoints: Number of elements in input arrays.
  • padfX: Input array of X coordinates.
  • padfY: Input array of Y coordinates.
  • padfZ: Input array of Z values.
  • bCallerWillKeepPointArraysAlive: Whether the provided padfX, padfY, padfZ arrays will still be "alive" during the calls to GDALGridContextProcess(). Setting to TRUE prevent them from being duplicated in the context. If unsure, set to FALSE.

Returns

the context (to be freed with GDALGridContextFree()) or NULL in case or error.

GDAL.gdalgridcontextfreeMethod
GDALGridContextFree(GDALGridContext * psContext) -> void

Free a context used created by GDALGridContextCreate()

Parameters

  • psContext: the context.
GDAL.gdalgridcontextprocessMethod
GDALGridContextProcess(GDALGridContext * psContext,
                       double dfXMin,
                       double dfXMax,
                       double dfYMin,
                       double dfYMax,
                       GUInt32 nXSize,
                       GUInt32 nYSize,
                       GDALDataType eType,
                       void * pData,
                       GDALProgressFunc pfnProgress,
                       void * pProgressArg) -> CPLErr

Do the gridding of a window of a raster.

Parameters

  • psContext: Gridding context.
  • dfXMin: Lowest X border of output grid.
  • dfXMax: Highest X border of output grid.
  • dfYMin: Lowest Y border of output grid.
  • dfYMax: Highest Y border of output grid.
  • nXSize: Number of columns in output grid.
  • nYSize: Number of rows in output grid.
  • eType: Data type of output array.
  • pData: Pointer to array where the computed grid will be stored.
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

CENone on success or CEFailure if something goes wrong.

GDAL.gdalgridcreateMethod
GDALGridCreate(GDALGridAlgorithm eAlgorithm,
               const void * poOptions,
               GUInt32 nPoints,
               const double * padfX,
               const double * padfY,
               const double * padfZ,
               double dfXMin,
               double dfXMax,
               double dfYMin,
               double dfYMax,
               GUInt32 nXSize,
               GUInt32 nYSize,
               GDALDataType eType,
               void * pData,
               GDALProgressFunc pfnProgress,
               void * pProgressArg) -> CPLErr

Create regular grid from the scattered data.

Parameters

  • eAlgorithm: Gridding method.
  • poOptions: Options to control chosen gridding method.
  • nPoints: Number of elements in input arrays.
  • padfX: Input array of X coordinates.
  • padfY: Input array of Y coordinates.
  • padfZ: Input array of Z values.
  • dfXMin: Lowest X border of output grid.
  • dfXMax: Highest X border of output grid.
  • dfYMin: Lowest Y border of output grid.
  • dfYMax: Highest Y border of output grid.
  • nXSize: Number of columns in output grid.
  • nYSize: Number of rows in output grid.
  • eType: Data type of output array.
  • pData: Pointer to array where the computed grid will be stored.
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

CENone on success or CEFailure if something goes wrong.

GDAL.gdalgridoptionsfreeMethod
GDALGridOptionsFree(GDALGridOptions * psOptions) -> void

Frees the GDALGridOptions struct.

Parameters

  • psOptions: the options struct for GDALGrid().
GDAL.gdalgridoptionsnewMethod
GDALGridOptionsNew(char ** papszArgv,
                   GDALGridOptionsForBinary * psOptionsForBinary) -> GDALGridOptions *

Allocates a GDALGridOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdal_translate utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALGridOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALGridOptions struct. Must be freed with GDALGridOptionsFree().

GDAL.gdalgridoptionssetprogressMethod
GDALGridOptionsSetProgress(GDALGridOptions * psOptions,
                           GDALProgressFunc pfnProgress,
                           void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALGrid().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalgroupcreateattributeMethod
GDALGroupCreateAttribute(GDALGroupH hGroup,
                         const char * pszName,
                         size_t nDimensions,
                         const GUInt64 * panDimensions,
                         GDALExtendedDataTypeH hEDT,
                         CSLConstList papszOptions) -> GDALAttributeH

Create a attribute within a group.

Returns

the attribute, to be freed with GDALAttributeRelease(), or nullptr.

GDAL.gdalgroupcreatedimensionMethod
GDALGroupCreateDimension(GDALGroupH hGroup,
                         const char * pszName,
                         const char * pszType,
                         const char * pszDirection,
                         GUInt64 nSize,
                         CSLConstList papszOptions) -> GDALDimensionH

Create a dimension within a group.

Returns

the dimension, to be freed with GDALDimensionRelease(), or nullptr.

GDAL.gdalgroupcreategroupMethod
GDALGroupCreateGroup(GDALGroupH hGroup,
                     const char * pszSubGroupName,
                     CSLConstList papszOptions) -> GDALGroupH

Create a sub-group within a group.

Returns

the sub-group, to be freed with GDALGroupRelease(), or nullptr.

GDAL.gdalgroupcreatemdarrayMethod
GDALGroupCreateMDArray(GDALGroupH hGroup,
                       const char * pszName,
                       size_t nDimensions,
                       GDALDimensionH * pahDimensions,
                       GDALExtendedDataTypeH hEDT,
                       CSLConstList papszOptions) -> GDALMDArrayH

Create a multidimensional array within a group.

Returns

the array, to be freed with GDALMDArrayRelease(), or nullptr.

GDAL.gdalgroupgetattributeMethod
GDALGroupGetAttribute(GDALGroupH hGroup,
                      const char * pszName) -> GDALAttributeH

Return an attribute by its name.

GDAL.gdalgroupgetattributesMethod
GDALGroupGetAttributes(GDALGroupH hGroup,
                       size_t * pnCount,
                       CSLConstList papszOptions) -> GDALAttributeH *

Return the list of attributes contained in this group.

Parameters

  • hGroup: Group.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.
  • papszOptions: Driver specific options determining how attributes should be retrieved. Pass nullptr for default behavior.

Returns

an array of *pnCount attributes.

GDAL.gdalgroupgetdimensionsMethod
GDALGroupGetDimensions(GDALGroupH hGroup,
                       size_t * pnCount,
                       CSLConstList papszOptions) -> GDALDimensionH *

Return the list of dimensions contained in this group and used by its arrays.

Parameters

  • hGroup: Group.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.
  • papszOptions: Driver specific options determining how dimensions should be retrieved. Pass nullptr for default behavior.

Returns

an array of *pnCount dimensions.

GDAL.gdalgroupgetfullnameMethod
GDALGroupGetFullName(GDALGroupH hGroup) -> const char *

Return the full name of the group.

GDAL.gdalgroupgetgroupnamesMethod
GDALGroupGetGroupNames(GDALGroupH hGroup,
                       CSLConstList papszOptions) -> char **

Return the list of sub-groups contained in this group.

Returns

the group names, to be freed with CSLDestroy()

GDAL.gdalgroupgetmdarraynamesMethod
GDALGroupGetMDArrayNames(GDALGroupH hGroup,
                         CSLConstList papszOptions) -> char **

Return the list of multidimensional array names contained in this group.

Returns

the array names, to be freed with CSLDestroy()

GDAL.gdalgroupgetnameMethod
GDALGroupGetName(GDALGroupH hGroup) -> const char *

Return the name of the group.

GDAL.gdalgroupgetvectorlayernamesMethod
GDALGroupGetVectorLayerNames(GDALGroupH hGroup,
                             CSLConstList papszOptions) -> char **

Return the list of layer names contained in this group.

Returns

the group names, to be freed with CSLDestroy()

GDAL.gdalgroupopengroupMethod
GDALGroupOpenGroup(GDALGroupH hGroup,
                   const char * pszSubGroupName,
                   CSLConstList papszOptions) -> GDALGroupH

Open and return a sub-group.

Returns

the sub-group, to be freed with GDALGroupRelease(), or nullptr.

GDAL.gdalgroupopengroupfromfullnameMethod
GDALGroupOpenGroupFromFullname(GDALGroupH hGroup,
                               const char * pszFullname,
                               CSLConstList papszOptions) -> GDALGroupH

Open and return a sub-group from its fully qualified name.

Returns

the sub-group, to be freed with GDALGroupRelease(), or nullptr.

GDAL.gdalgroupopenmdarrayMethod
GDALGroupOpenMDArray(GDALGroupH hGroup,
                     const char * pszMDArrayName,
                     CSLConstList papszOptions) -> GDALMDArrayH

Open and return a multidimensional array.

Returns

the array, to be freed with GDALMDArrayRelease(), or nullptr.

GDAL.gdalgroupopenmdarrayfromfullnameMethod
GDALGroupOpenMDArrayFromFullname(GDALGroupH hGroup,
                                 const char * pszFullname,
                                 CSLConstList papszOptions) -> GDALMDArrayH

Open and return a multidimensional array from its fully qualified name.

Returns

the array, to be freed with GDALMDArrayRelease(), or nullptr.

GDAL.gdalgroupopenvectorlayerMethod
GDALGroupOpenVectorLayer(GDALGroupH hGroup,
                         const char * pszVectorLayerName,
                         CSLConstList papszOptions) -> OGRLayerH

Open and return a vector layer.

Returns

the vector layer, or nullptr.

GDAL.gdalgroupreleaseMethod
GDALGroupRelease(GDALGroupH hGroup) -> void

Release the GDAL in-memory object associated with a GDALGroupH.

GDAL.gdalgroupresolvemdarrayMethod
GDALGroupResolveMDArray(GDALGroupH hGroup,
                        const char * pszName,
                        const char * pszStartingPoint,
                        CSLConstList papszOptions) -> GDALMDArrayH

Locate an array in a group and its subgroups by name.

GDAL.gdalhastriangulationMethod
GDALHasTriangulation() -> int

Returns if GDAL is built with Delaunay triangulation support.

Returns

TRUE if GDAL is built with Delaunay triangulation support.

GDAL.gdalidentifydriverMethod
GDALIdentifyDriver(const char * pszFilename,
                   CSLConstList papszFileList) -> GDALDriverH

Identify the driver that can open a raster file.

Parameters

  • pszFilename: the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset.
  • papszFileList: an array of strings, whose last element is the NULL pointer. These strings are filenames that are auxiliary to the main filename. The passed value may be NULL.

Returns

A GDALDriverH handle or NULL on failure. For C++ applications this handle can be cast to a GDALDriver *.

GDAL.gdalidentifydriverexMethod
GDALIdentifyDriverEx(const char * pszFilename,
                     unsigned int nIdentifyFlags,
                     const char *const * papszAllowedDrivers,
                     const char *const * papszFileList) -> GDALDriverH

Identify the driver that can open a raster file.

Parameters

  • pszFilename: the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset.
  • nIdentifyFlags: a combination of GDALOFRASTER for raster drivers or GDALOFVECTOR for vector drivers. If none of the value is specified, both kinds are implied.
  • papszAllowedDrivers: NULL to consider all candidate drivers, or a NULL terminated list of strings with the driver short names that must be considered.
  • papszFileList: an array of strings, whose last element is the NULL pointer. These strings are filenames that are auxiliary to the main filename. The passed value may be NULL.

Returns

A GDALDriverH handle or NULL on failure. For C++ applications this handle can be cast to a GDALDriver *.

GDAL.gdalinfoMethod
GDALInfo(GDALDatasetH hDataset,
         const GDALInfoOptions * psOptions) -> char *

Lists various information about a GDAL supported raster dataset.

Parameters

  • hDataset: the dataset handle.
  • psOptions: the options structure returned by GDALInfoOptionsNew() or NULL.

Returns

string corresponding to the information about the raster dataset (must be freed with CPLFree()), or NULL in case of error.

GDAL.gdalinfooptionsfreeMethod
GDALInfoOptionsFree(GDALInfoOptions * psOptions) -> void

Frees the GDALInfoOptions struct.

Parameters

  • psOptions: the options struct for GDALInfo().
GDAL.gdalinfooptionsnewMethod
GDALInfoOptionsNew(char ** papszArgv,
                   GDALInfoOptionsForBinary * psOptionsForBinary) -> GDALInfoOptions *

Allocates a GDALInfoOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdalinfo utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdalinfo_bin.cpp use case) must be allocated with GDALInfoOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options, subdataset number...

Returns

pointer to the allocated GDALInfoOptions struct. Must be freed with GDALInfoOptionsFree().

GDAL.gdalinitgcpsMethod
GDALInitGCPs(int nCount,
             GDAL_GCP * psGCP) -> void

Initialize an array of GCPs.

Parameters

  • nCount: number of GCPs in psGCP
  • psGCP: array of GCPs of size nCount.
GDAL.gdalinitializewarpedvrtMethod
GDALInitializeWarpedVRT(GDALDatasetH hDS,
                        GDALWarpOptions * psWO) -> CPLErr

Set warp info on virtual warped dataset.

Parameters

  • hDS: dataset previously created with the VRT driver, and a SUBCLASS of "VRTWarpedDataset".
  • psWO: the warp options to apply. Note that ownership of the transformation information is taken over by the function though everything else remains the property of the caller.

Returns

CENone on success or CEFailure if an error occurs.

GDAL.gdalinvgeotransformMethod
GDALInvGeoTransform(double * gt_in,
                    double * gt_out) -> int

Invert Geotransform.

Parameters

  • gt_in: Input geotransform (six doubles - unaltered).
  • gt_out: Output geotransform (six doubles - updated).

Returns

TRUE on success or FALSE if the equation is uninvertable.

GDAL.gdalismaskbandMethod
GDALIsMaskBand(GDALRasterBandH hBand) -> bool

Returns whether a band is a mask band.

Returns

true if the band is a mask band.

GDAL.gdaljl_errorhandlerMethod

The custom GDAL error handling function that we set in init

This function will get called by GDAL itself when it decides it wants to throw an error. We turn the error into a GDALError and throw it from Julia. This allows us to get GDALErrors that look similar to the ones that we throw when our own error checking code decides it should throw.

GDAL.gdalloadozimapfileMethod
GDALLoadOziMapFile(const char * pszFilename,
                   double * padfGeoTransform,
                   char ** ppszWKT,
                   int * pnGCPCount,
                   GDAL_GCP ** ppasGCPs) -> int

Helper function for translator implementer wanting support for OZI .map.

Parameters

  • pszFilename: filename of .tab file
  • padfGeoTransform: output geotransform. Must hold 6 doubles.
  • ppszWKT: output pointer to a string that will be allocated with CPLMalloc().
  • pnGCPCount: output pointer to GCP count.
  • ppasGCPs: outputer pointer to an array of GCPs.

Returns

TRUE in case of success, FALSE otherwise.

GDAL.gdalloadtabfileMethod
GDALLoadTabFile(const char * pszFilename,
                double * padfGeoTransform,
                char ** ppszWKT,
                int * pnGCPCount,
                GDAL_GCP ** ppasGCPs) -> int

Helper function for translator implementer wanting support for MapInfo .tab files.

Parameters

  • pszFilename: filename of .tab
  • padfGeoTransform: output geotransform. Must hold 6 doubles.
  • ppszWKT: output pointer to a string that will be allocated with CPLMalloc().
  • pnGCPCount: output pointer to GCP count.
  • ppasGCPs: outputer pointer to an array of GCPs.

Returns

TRUE in case of success, FALSE otherwise.

GDAL.gdalloadworldfileMethod
GDALLoadWorldFile(const char * pszFilename,
                  double * padfGeoTransform) -> int

Read ESRI world file.

Parameters

  • pszFilename: the world file name.
  • padfGeoTransform: the six double array into which the geotransformation should be placed.

Returns

TRUE on success or FALSE on failure.

GDAL.gdalmdarrayadvisereadMethod
GDALMDArrayAdviseRead(GDALMDArrayH hArray,
                      const GUInt64 * arrayStartIdx,
                      const size_t * count) -> int

Advise driver of upcoming read requests.

Returns

TRUE in case of success.

GDAL.gdalmdarrayadvisereadexMethod
GDALMDArrayAdviseReadEx(GDALMDArrayH hArray,
                        const GUInt64 * arrayStartIdx,
                        const size_t * count,
                        CSLConstList papszOptions) -> int

Advise driver of upcoming read requests.

Returns

TRUE in case of success.

GDAL.gdalmdarrayasclassicdatasetMethod
GDALMDArrayAsClassicDataset(GDALMDArrayH hArray,
                            size_t iXDim,
                            size_t iYDim) -> GDALDatasetH

Return a view of this array as a "classic" GDALDataset (ie 2D)

Parameters

  • hArray: Array.
  • iXDim: Index of the dimension that will be used as the X/width axis.
  • iYDim: Index of the dimension that will be used as the Y/height axis.

Returns

a new GDALDataset that must be freed with GDALClose(), or nullptr

GDAL.gdalmdarraycacheMethod
GDALMDArrayCache(GDALMDArrayH hArray,
                 CSLConstList papszOptions) -> int

Cache the content of the array into an auxiliary filename.

GDAL.gdalmdarraycomputestatisticsMethod
GDALMDArrayComputeStatistics(GDALMDArrayH hArray,
                             GDALDatasetH,
                             int bApproxOK,
                             double * pdfMin,
                             double * pdfMax,
                             double * pdfMean,
                             double * pdfStdDev,
                             GUInt64 * pnValidCount,
                             GDALProgressFunc pfnProgress,
                             void * pProgressData) -> int

Compute statistics.

GDAL.gdalmdarraycreateattributeMethod
GDALMDArrayCreateAttribute(GDALMDArrayH hArray,
                           const char * pszName,
                           size_t nDimensions,
                           const GUInt64 * panDimensions,
                           GDALExtendedDataTypeH hEDT,
                           CSLConstList papszOptions) -> GDALAttributeH

Create a attribute within an array.

Returns

the attribute, to be freed with GDALAttributeRelease(), or nullptr.

GDAL.gdalmdarraygetattributeMethod
GDALMDArrayGetAttribute(GDALMDArrayH hArray,
                        const char * pszName) -> GDALAttributeH

Return an attribute by its name.

GDAL.gdalmdarraygetattributesMethod
GDALMDArrayGetAttributes(GDALMDArrayH hArray,
                         size_t * pnCount,
                         CSLConstList papszOptions) -> GDALAttributeH *

Return the list of attributes contained in this array.

Parameters

  • hArray: Array.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.
  • papszOptions: Driver specific options determining how attributes should be retrieved. Pass nullptr for default behavior.

Returns

an array of *pnCount attributes.

GDAL.gdalmdarraygetblocksizeMethod
GDALMDArrayGetBlockSize(GDALMDArrayH hArray,
                        size_t * pnCount) -> GUInt64 *

Return the "natural" block size of the array along all dimensions.

Returns

the block size, in number of elements along each dimension.

GDAL.gdalmdarraygetcoordinatevariablesMethod
GDALMDArrayGetCoordinateVariables(GDALMDArrayH hArray,
                                  size_t * pnCount) -> GDALMDArrayH *

Return coordinate variables.

Parameters

  • hArray: Array.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.

Returns

an array of *pnCount arrays.

GDAL.gdalmdarraygetdimensionsMethod
GDALMDArrayGetDimensions(GDALMDArrayH hArray,
                         size_t * pnCount) -> GDALDimensionH *

Return the dimensions of the array.

Parameters

  • hArray: Array.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.

Returns

an array of *pnCount dimensions.

GDAL.gdalmdarraygetgriddedMethod
GDALMDArrayGetGridded(GDALMDArrayH hArray,
                      const char * pszGridOptions,
                      GDALMDArrayH hXArray,
                      GDALMDArrayH hYArray,
                      CSLConstList papszOptions) -> GDALMDArrayH

Return a gridded array from scattered point data, that is from an array whose last dimension is the indexing variable of X and Y arrays.

GDAL.gdalmdarraygetmaskMethod
GDALMDArrayGetMask(GDALMDArrayH hArray,
                   CSLConstList papszOptions) -> GDALMDArrayH

Return an array that is a mask for the current array.

GDAL.gdalmdarraygetnodatavalueasdoubleMethod
GDALMDArrayGetNoDataValueAsDouble(GDALMDArrayH hArray,
                                  int * pbHasNoDataValue) -> double

Return the nodata value as a double.

Parameters

  • hArray: Array handle.
  • pbHasNoDataValue: Pointer to a output boolean that will be set to true if a nodata value exists and can be converted to double. Might be nullptr.

Returns

the nodata value as a double. A 0.0 value might also indicate the absence of a nodata value or an error in the conversion (*pbHasNoDataValue will be set to false then).

GDAL.gdalmdarraygetnodatavalueasint64Method
GDALMDArrayGetNoDataValueAsInt64(GDALMDArrayH hArray,
                                 int * pbHasNoDataValue) -> int64_t

Return the nodata value as a Int64.

Parameters

  • hArray: Array handle.
  • pbHasNoDataValue: Pointer to a output boolean that will be set to true if a nodata value exists and can be converted to Int64. Might be nullptr.

Returns

the nodata value as a Int64.

GDAL.gdalmdarraygetnodatavalueasuint64Method
GDALMDArrayGetNoDataValueAsUInt64(GDALMDArrayH hArray,
                                  int * pbHasNoDataValue) -> uint64_t

Return the nodata value as a UInt64.

Parameters

  • hArray: Array handle.
  • pbHasNoDataValue: Pointer to a output boolean that will be set to true if a nodata value exists and can be converted to UInt64. Might be nullptr.

Returns

the nodata value as a UInt64.

GDAL.gdalmdarraygetoffsetMethod
GDALMDArrayGetOffset(GDALMDArrayH hArray,
                     int * pbHasValue) -> double

Get the scale value to apply to raw values.

Returns

the scale value

GDAL.gdalmdarraygetoffsetexMethod
GDALMDArrayGetOffsetEx(GDALMDArrayH hArray,
                       int * pbHasValue,
                       GDALDataType * peStorageType) -> double

Get the scale value to apply to raw values.

Returns

the scale value

GDAL.gdalmdarraygetprocessingchunksizeMethod
GDALMDArrayGetProcessingChunkSize(GDALMDArrayH hArray,
                                  size_t * pnCount,
                                  size_t nMaxChunkMemory) -> size_t *

Return an optimal chunk size for read/write operations, given the natural block size and memory constraints specified.

Parameters

  • hArray: Array.
  • pnCount: Pointer to the number of values returned. Must NOT be NULL.
  • nMaxChunkMemory: Maximum amount of memory, in bytes, to use for the chunk.

Returns

the chunk size, in number of elements along each dimension.

GDAL.gdalmdarraygetrawnodatavalueMethod
GDALMDArrayGetRawNoDataValue(GDALMDArrayH hArray) -> const void *

Return the nodata value as a "raw" value.

Returns

nullptr or a pointer to GetDataType().GetSize() bytes.

GDAL.gdalmdarraygetresampledMethod
GDALMDArrayGetResampled(GDALMDArrayH hArray,
                        size_t nNewDimCount,
                        const GDALDimensionH * pahNewDims,
                        GDALRIOResampleAlg resampleAlg,
                        OGRSpatialReferenceH hTargetSRS,
                        CSLConstList papszOptions) -> GDALMDArrayH

Return an array that is a resampled / reprojected view of the current array.

GDAL.gdalmdarraygetscaleMethod
GDALMDArrayGetScale(GDALMDArrayH hArray,
                    int * pbHasValue) -> double

Get the scale value to apply to raw values.

Returns

the scale value

GDAL.gdalmdarraygetscaleexMethod
GDALMDArrayGetScaleEx(GDALMDArrayH hArray,
                      int * pbHasValue,
                      GDALDataType * peStorageType) -> double

Get the scale value to apply to raw values.

Returns

the scale value

GDAL.gdalmdarraygetspatialrefMethod
GDALMDArrayGetSpatialRef(GDALMDArrayH hArray) -> OGRSpatialReferenceH

Return the spatial reference system object associated with the array.

GDAL.gdalmdarraygetstatisticsMethod
GDALMDArrayGetStatistics(GDALMDArrayH hArray,
                         GDALDatasetH,
                         int bApproxOK,
                         int bForce,
                         double * pdfMin,
                         double * pdfMax,
                         double * pdfMean,
                         double * pdfStdDev,
                         GUInt64 * pnValidCount,
                         GDALProgressFunc pfnProgress,
                         void * pProgressData) -> CPLErr

Fetch statistics.

GDAL.gdalmdarraygetunscaledMethod
GDALMDArrayGetUnscaled(GDALMDArrayH hArray) -> GDALMDArrayH

Return an array that is the unscaled version of the current one.

GDAL.gdalmdarraygetviewMethod
GDALMDArrayGetView(GDALMDArrayH hArray,
                   const char * pszViewExpr) -> GDALMDArrayH

Return a view of the array using slicing or field access.

GDAL.gdalmdarrayreadMethod
GDALMDArrayRead(GDALMDArrayH hArray,
                const GUInt64 * arrayStartIdx,
                const size_t * count,
                const GInt64 * arrayStep,
                const GPtrDiff_t * bufferStride,
                GDALExtendedDataTypeH bufferDataType,
                void * pDstBuffer,
                const void * pDstBufferAllocStart,
                size_t nDstBufferAllocSize) -> int

Read part or totality of a multidimensional array.

Returns

TRUE in case of success.

GDAL.gdalmdarrayreleaseMethod
GDALMDArrayRelease(GDALMDArrayH hMDArray) -> void

Release the GDAL in-memory object associated with a GDALMDArray.

GDAL.gdalmdarrayresizeMethod
GDALMDArrayResize(GDALMDArrayH hArray,
                  const GUInt64 * panNewDimSizes,
                  CSLConstList papszOptions) -> bool

Resize an array to new dimensions.

Parameters

  • hArray: Array.
  • panNewDimSizes: Array of GetDimensionCount() values containing the new size of each indexing dimension.
  • papszOptions: Options. (Driver specific)

Returns

true in case of success.

GDAL.gdalmdarraysetnodatavalueasdoubleMethod
GDALMDArraySetNoDataValueAsDouble(GDALMDArrayH hArray,
                                  double dfNoDataValue) -> int

Set the nodata value as a double.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetnodatavalueasint64Method
GDALMDArraySetNoDataValueAsInt64(GDALMDArrayH hArray,
                                 int64_t nNoDataValue) -> int

Set the nodata value as a Int64.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetnodatavalueasuint64Method
GDALMDArraySetNoDataValueAsUInt64(GDALMDArrayH hArray,
                                  uint64_t nNoDataValue) -> int

Set the nodata value as a UInt64.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetoffsetMethod
GDALMDArraySetOffset(GDALMDArrayH hArray,
                     double dfOffset) -> int

Set the scale value to apply to raw values.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetoffsetexMethod
GDALMDArraySetOffsetEx(GDALMDArrayH hArray,
                       double dfOffset,
                       GDALDataType eStorageType) -> int

Set the scale value to apply to raw values.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetrawnodatavalueMethod
GDALMDArraySetRawNoDataValue(GDALMDArrayH hArray,
                             const void * pNoData) -> int

Set the nodata value as a "raw" value.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetscaleMethod
GDALMDArraySetScale(GDALMDArrayH hArray,
                    double dfScale) -> int

Set the scale value to apply to raw values.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetscaleexMethod
GDALMDArraySetScaleEx(GDALMDArrayH hArray,
                      double dfScale,
                      GDALDataType eStorageType) -> int

Set the scale value to apply to raw values.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetspatialrefMethod
GDALMDArraySetSpatialRef(GDALMDArrayH hArray,
                         OGRSpatialReferenceH hSRS) -> int

Assign a spatial reference system object to the array.

Returns

TRUE in case of success.

GDAL.gdalmdarraysetunitMethod
GDALMDArraySetUnit(GDALMDArrayH hArray,
                   const char * pszUnit) -> int

Set the variable unit.

Parameters

  • hArray: array.
  • pszUnit: unit name.

Returns

TRUE in case of success.

GDAL.gdalmdarraytransposeMethod
GDALMDArrayTranspose(GDALMDArrayH hArray,
                     size_t nNewAxisCount,
                     const int * panMapNewAxisToOldAxis) -> GDALMDArrayH

Return a view of the array whose axis have been reordered.

GDAL.gdalmdarraywriteMethod
GDALMDArrayWrite(GDALMDArrayH hArray,
                 const GUInt64 * arrayStartIdx,
                 const size_t * count,
                 const GInt64 * arrayStep,
                 const GPtrDiff_t * bufferStride,
                 GDALExtendedDataTypeH bufferDataType,
                 const void * pSrcBuffer,
                 const void * pSrcBufferAllocStart,
                 size_t nSrcBufferAllocSize) -> int

Write part or totality of a multidimensional array.

Returns

TRUE in case of success.

GDAL.gdalmultidiminfoMethod
GDALMultiDimInfo(GDALDatasetH hDataset,
                 const GDALMultiDimInfoOptions * psOptionsIn) -> char *

Lists various information about a GDAL multidimensional dataset.

Parameters

  • hDataset: the dataset handle.
  • psOptionsIn: the options structure returned by GDALMultiDimInfoOptionsNew() or NULL.

Returns

string corresponding to the information about the raster dataset (must be freed with CPLFree()), or NULL in case of error.

GDAL.gdalmultidiminfooptionsfreeMethod
GDALMultiDimInfoOptionsFree(GDALMultiDimInfoOptions * psOptions) -> void

Frees the GDALMultiDimInfoOptions struct.

Parameters

  • psOptions: the options struct for GDALMultiDimInfo().
GDAL.gdalmultidiminfooptionsnewMethod
GDALMultiDimInfoOptionsNew(char ** papszArgv,
                           GDALMultiDimInfoOptionsForBinary * psOptionsForBinary) -> GDALMultiDimInfoOptions *

Allocates a GDALMultiDimInfo struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdalmdiminfo utility.
  • psOptionsForBinary: should be nullptr, unless called from gdalmultidiminfo_bin.cpp

Returns

pointer to the allocated GDALMultiDimInfoOptions struct. Must be freed with GDALMultiDimInfoOptionsFree().

GDAL.gdalmultidimtranslateMethod
GDALMultiDimTranslate(const char * pszDest,
                      GDALDatasetH hDstDS,
                      int nSrcCount,
                      GDALDatasetH * pahSrcDS,
                      const GDALMultiDimTranslateOptions * psOptions,
                      int * pbUsageError) -> GDALDatasetH

Converts raster data between different formats.

Parameters

  • pszDest: the destination dataset path or NULL.
  • hDstDS: the destination dataset or NULL.
  • nSrcCount: the number of input datasets.
  • pahSrcDS: the list of input datasets.
  • psOptions: the options struct returned by GDALMultiDimTranslateOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose(), or hDstDS is not NULL) or NULL in case of error.

GDAL.gdalmultidimtranslateoptionsfreeMethod
GDALMultiDimTranslateOptionsFree(GDALMultiDimTranslateOptions * psOptions) -> void

Frees the GDALMultiDimTranslateOptions struct.

Parameters

  • psOptions: the options struct for GDALMultiDimTranslate().
GDAL.gdalmultidimtranslateoptionsnewMethod
GDALMultiDimTranslateOptionsNew(char ** papszArgv,
                                GDALMultiDimTranslateOptionsForBinary * psOptionsForBinary) -> GDALMultiDimTranslateOptions *

Allocates a GDALMultiDimTranslateOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdalmdimtranslate utility.
  • psOptionsForBinary: should be nullptr, unless called from gdalmdimtranslate_bin.cpp

Returns

pointer to the allocated GDALMultiDimTranslateOptions struct. Must be freed with GDALMultiDimTranslateOptionsFree().

GDAL.gdalmultidimtranslateoptionssetprogressMethod
GDALMultiDimTranslateOptionsSetProgress(GDALMultiDimTranslateOptions * psOptions,
                                        GDALProgressFunc pfnProgress,
                                        void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALMultiDimTranslate().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalnearblackMethod
GDALNearblack(const char * pszDest,
              GDALDatasetH hDstDS,
              GDALDatasetH hSrcDataset,
              const GDALNearblackOptions * psOptionsIn,
              int * pbUsageError) -> GDALDatasetH

Convert nearly black/white borders to exact value.

Parameters

  • pszDest: the destination dataset path or NULL.
  • hDstDS: the destination dataset or NULL. Might be equal to hSrcDataset.
  • hSrcDataset: the source dataset handle.
  • psOptionsIn: the options struct returned by GDALNearblackOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose(), or hDstDS when it is not NULL) or NULL in case of error.

GDAL.gdalnearblackoptionsfreeMethod
GDALNearblackOptionsFree(GDALNearblackOptions * psOptions) -> void

Frees the GDALNearblackOptions struct.

Parameters

  • psOptions: the options struct for GDALNearblack().
GDAL.gdalnearblackoptionsnewMethod
GDALNearblackOptionsNew(char ** papszArgv,
                        GDALNearblackOptionsForBinary * psOptionsForBinary) -> GDALNearblackOptions *

Allocates a GDALNearblackOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the nearblack utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALNearblackOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALNearblackOptions struct. Must be freed with GDALNearblackOptionsFree().

GDAL.gdalnearblackoptionssetprogressMethod
GDALNearblackOptionsSetProgress(GDALNearblackOptions * psOptions,
                                GDALProgressFunc pfnProgress,
                                void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALNearblack().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalopenMethod
GDALOpen(const char * pszFilename,
         GDALAccess eAccess) -> GDALDatasetH

Open a raster file as a GDALDataset.

Parameters

  • pszFilename: the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset. It should be in UTF-8 encoding.
  • eAccess: the desired access, either GAUpdate or GAReadOnly. Many drivers support only read only access.

Returns

A GDALDatasetH handle or NULL on failure. For C++ applications this handle can be cast to a GDALDataset *.

GDAL.gdalopenexMethod
GDALOpenEx(const char * pszFilename,
           unsigned int nOpenFlags,
           const char *const * papszAllowedDrivers,
           const char *const * papszOpenOptions,
           const char *const * papszSiblingFiles) -> GDALDatasetH

Open a raster or vector file as a GDALDataset.

Parameters

  • pszFilename: the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset. It should be in UTF-8 encoding.
  • nOpenFlags: a combination of GDALOF flags that may be combined through logical or operator.

Driver kind:

GDALOFRASTER for raster drivers,

GDALOFMULTIDIM_RASTER for multidimensional raster drivers,

GDALOFVECTOR for vector drivers,

GDALOFGNM for Geographic Network Model drivers.

GDALOFRASTER and GDALOFMULTIDIMRASTER are generally mutually exclusive. If none of the value is specified, GDALOFRASTER | GDALOFVECTOR | GDALOF_GNM is implied.

Access mode: GDALOFREADONLY (exclusive)or GDALOFUPDATE.

Shared mode: GDALOFSHARED. If set, it allows the sharing of GDALDataset handles for a dataset with other callers that have set GDALOFSHARED. In particular, GDALOpenEx() will first consult its list of currently open and shared GDALDataset's, and if the GetDescription() name for one exactly matches the pszFilename passed to GDALOpenEx() it will be referenced and returned, if GDALOpenEx() is called from the same thread.

Verbose error: GDALOFVERBOSE_ERROR. If set, a failed attempt to open the file will lead to an error message to be reported.

  • papszAllowedDrivers: NULL to consider all candidate drivers, or a NULL terminated list of strings with the driver short names that must be considered.
  • papszOpenOptions: NULL, or a NULL terminated list of strings with open options passed to candidate drivers. An option exists for all drivers, OVERVIEWLEVEL=level, to select a particular overview level of a dataset. The level index starts at 0. The level number can be suffixed by "only" to specify that only this overview level must be visible, and not sub-levels. Open options are validated by default, and a warning is emitted in case the option is not recognized. In some scenarios, it might be not desirable (e.g. when not knowing which driver will open the file), so the special open option VALIDATEOPENOPTIONS can be set to NO to avoid such warnings. Alternatively, since GDAL 2.1, an option name can be preceded by the @ character to indicate that it may not cause a warning if the driver doesn't declare this option. Starting with GDAL 3.3, OVERVIEWLEVEL=NONE is supported to indicate that no overviews should be exposed.
  • papszSiblingFiles: NULL, or a NULL terminated list of strings that are filenames that are auxiliary to the main filename. If NULL is passed, a probing of the file system will be done.

Returns

A GDALDatasetH handle or NULL on failure. For C++ applications this handle can be cast to a GDALDataset *.

GDAL.gdalopensharedMethod
GDALOpenShared(const char * pszFilename,
               GDALAccess eAccess) -> GDALDatasetH

Open a raster file as a GDALDataset.

Parameters

  • pszFilename: the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset. It should be in UTF-8 encoding.
  • eAccess: the desired access, either GAUpdate or GAReadOnly. Many drivers support only read only access.

Returns

A GDALDatasetH handle or NULL on failure. For C++ applications this handle can be cast to a GDALDataset *.

GDAL.gdaloverviewmagnitudecorrectionMethod
GDALOverviewMagnitudeCorrection(GDALRasterBandH hBaseBand,
                                int nOverviewCount,
                                GDALRasterBandH * pahOverviews,
                                GDALProgressFunc pfnProgress,
                                void * pProgressData) -> CPLErr

Undocumented.

Parameters

  • hBaseBand: undocumented.
  • nOverviewCount: undocumented.
  • pahOverviews: undocumented.
  • pfnProgress: undocumented.
  • pProgressData: undocumented.

Returns

undocumented

GDAL.gdalpackeddmstodecMethod
GDALPackedDMSToDec(double dfPacked) -> double

Convert a packed DMS value (DDDMMMSSS.SS) into decimal degrees.

GDAL.gdalpolygonizeMethod
GDALPolygonize(GDALRasterBandH hSrcBand,
               GDALRasterBandH hMaskBand,
               OGRLayerH hOutLayer,
               int iPixValField,
               char ** papszOptions,
               GDALProgressFunc pfnProgress,
               void * pProgressArg) -> CPLErr

Create polygon coverage from raster data.

Parameters

  • hSrcBand: the source raster band to be processed.
  • hMaskBand: an optional mask band. All pixels in the mask band with a value other than zero will be considered suitable for collection as polygons.
  • hOutLayer: the vector feature layer to which the polygons should be written.
  • iPixValField: the attribute field index indicating the feature attribute into which the pixel value of the polygon should be written. Or -1 to indicate that the pixel value must not be written.
  • papszOptions: a name/value list of additional options

8CONNECTED=8: May be set to "8" to use 8 connectedness. Otherwise 4 connectedness will be applied to the algorithm

DATASETFORGEOREF=dataset_name: Name of a dataset from which to read the geotransform. This useful if hSrcBand has no related dataset, which is typical for mask bands.

  • pfnProgress: callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
  • pProgressArg: callback argument passed to pfnProgress.

Returns

CENone on success or CEFailure on a failure.

GDAL.gdalrasteradvisereadMethod
GDALRasterAdviseRead(GDALRasterBandH hBand,
                     int nXOff,
                     int nYOff,
                     int nXSize,
                     int nYSize,
                     int nBufXSize,
                     int nBufYSize,
                     GDALDataType eDT,
                     CSLConstList papszOptions) -> CPLErr

Advise driver of upcoming read requests.

GDAL.gdalrasterbandasmdarrayMethod
GDALRasterBandAsMDArray(GDALRasterBandH hBand) -> GDALMDArrayH

Return a view of this raster band as a 2D multidimensional GDALMDArray.

Returns

a new array, or NULL.

GDAL.gdalrasterbandcopywholerasterMethod
GDALRasterBandCopyWholeRaster(GDALRasterBandH hSrcBand,
                              GDALRasterBandH hDstBand,
                              const char *const *const papszOptions,
                              GDALProgressFunc pfnProgress,
                              void * pProgressData) -> CPLErr

Copy a whole raster band.

Parameters

  • hSrcBand: the source band
  • hDstBand: the destination band
  • papszOptions: transfer hints in "StringList" Name=Value format.
  • pfnProgress: progress reporting function.
  • pProgressData: callback data for progress function.

Returns

CENone on success, or CEFailure on failure.

GDAL.gdalrasterbandgettiledvirtualmemMethod
GDALRasterBandGetTiledVirtualMem(GDALRasterBandH hBand,
                                 GDALRWFlag eRWFlag,
                                 int nXOff,
                                 int nYOff,
                                 int nXSize,
                                 int nYSize,
                                 int nTileXSize,
                                 int nTileYSize,
                                 GDALDataType eBufType,
                                 size_t nCacheSize,
                                 int bSingleThreadUsage,
                                 CSLConstList papszOptions) -> CPLVirtualMem *

Create a CPLVirtualMem object from a GDAL rasterband object, with tiling organization.

Parameters

  • hBand: Rasterband object
  • eRWFlag: Either GFRead to read a region of data, or GFWrite to write a region of data.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • nTileXSize: the width of the tiles.
  • nTileYSize: the height of the tiles.
  • eBufType: the type of the pixel values in the data buffer. The pixel values will automatically be translated to/from the GDALRasterBand data type as needed.
  • nCacheSize: size in bytes of the maximum memory that will be really allocated (must ideally fit into RAM)
  • bSingleThreadUsage: set to TRUE if there will be no concurrent threads that will access the virtual memory mapping. This can optimize performance a bit. If set to FALSE, CPLVirtualMemDeclareThread() must be called.
  • papszOptions: NULL terminated list of options. Unused for now.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.gdalrasterbandgetvirtualmemMethod
GDALRasterBandGetVirtualMem(GDALRasterBandH hBand,
                            GDALRWFlag eRWFlag,
                            int nXOff,
                            int nYOff,
                            int nXSize,
                            int nYSize,
                            int nBufXSize,
                            int nBufYSize,
                            GDALDataType eBufType,
                            int nPixelSpace,
                            GIntBig nLineSpace,
                            size_t nCacheSize,
                            size_t nPageSizeHint,
                            int bSingleThreadUsage,
                            CSLConstList papszOptions) -> CPLVirtualMem *

Create a CPLVirtualMem object from a GDAL raster band object.

Parameters

  • hBand: Rasterband object
  • eRWFlag: Either GFRead to read a region of data, or GFWrite to write a region of data.
  • nXOff: The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
  • nYOff: The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
  • nXSize: The width of the region of the band to be accessed in pixels.
  • nYSize: The height of the region of the band to be accessed in lines.
  • nBufXSize: the width of the buffer image into which the desired region is to be read, or from which it is to be written.
  • nBufYSize: the height of the buffer image into which the desired region is to be read, or from which it is to be written.
  • eBufType: the type of the pixel values in the data buffer. The pixel values will automatically be translated to/from the GDALRasterBand data type as needed.
  • nPixelSpace: The byte offset from the start of one pixel value in the buffer to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype eBufType is used.
  • nLineSpace: The byte offset from the start of one scanline in the buffer to the start of the next. If defaulted (0) the size of the datatype eBufType * nBufXSize is used.
  • nCacheSize: size in bytes of the maximum memory that will be really allocated (must ideally fit into RAM)
  • nPageSizeHint: hint for the page size. Must be a multiple of the system page size, returned by CPLGetPageSize(). Minimum value is generally 4096. Might be set to 0 to let the function determine a default page size.
  • bSingleThreadUsage: set to TRUE if there will be no concurrent threads that will access the virtual memory mapping. This can optimize performance a bit. If set to FALSE, CPLVirtualMemDeclareThread() must be called.
  • papszOptions: NULL terminated list of options. Unused for now.

Returns

a virtual memory object that must be freed by CPLVirtualMemFree(), or NULL in case of failure.

GDAL.gdalrasterioMethod
GDALRasterIO(GDALRasterBandH hBand,
             GDALRWFlag eRWFlag,
             int nXOff,
             int nYOff,
             int nXSize,
             int nYSize,
             void * pData,
             int nBufXSize,
             int nBufYSize,
             GDALDataType eBufType,
             int nPixelSpace,
             int nLineSpace) -> CPLErr

Read/write a region of image data for this band.

GDAL.gdalrasterioexMethod
GDALRasterIOEx(GDALRasterBandH hBand,
               GDALRWFlag eRWFlag,
               int nXOff,
               int nYOff,
               int nXSize,
               int nYSize,
               void * pData,
               int nBufXSize,
               int nBufYSize,
               GDALDataType eBufType,
               GSpacing nPixelSpace,
               GSpacing nLineSpace,
               GDALRasterIOExtraArg * psExtraArg) -> CPLErr

Read/write a region of image data for this band.

GDAL.gdalrasterizeMethod
GDALRasterize(const char * pszDest,
              GDALDatasetH hDstDS,
              GDALDatasetH hSrcDataset,
              const GDALRasterizeOptions * psOptionsIn,
              int * pbUsageError) -> GDALDatasetH

Burns vector geometries into a raster.

Parameters

  • pszDest: the destination dataset path or NULL.
  • hDstDS: the destination dataset or NULL.
  • hSrcDataset: the source dataset handle.
  • psOptionsIn: the options struct returned by GDALRasterizeOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose(), or hDstDS is not NULL) or NULL in case of error.

GDAL.gdalrasterizegeometriesMethod
gdalrasterizegeometries(hDS, nBandCount, panBandList, nGeomCount, pahGeometries, pfnTransformer, pTransformArg, padfGeomBurnValues, papszOptions, pfnProgress, pProgressArg)

GDAL.gdalrasterizegeometriesint64Method
GDALRasterizeGeometriesInt64(GDALDatasetH hDS,
                             int nBandCount,
                             const int * panBandList,
                             int nGeomCount,
                             const OGRGeometryH * pahGeometries,
                             GDALTransformerFunc pfnTransformer,
                             void * pTransformArg,
                             const int64_t * panGeomBurnValues,
                             CSLConstList papszOptions,
                             GDALProgressFunc pfnProgress,
                             void * pProgressArg) -> CPLErr

Burn geometries into raster.

GDAL.gdalrasterizelayersMethod
GDALRasterizeLayers(GDALDatasetH hDS,
                    int nBandCount,
                    int * panBandList,
                    int nLayerCount,
                    OGRLayerH * pahLayers,
                    GDALTransformerFunc pfnTransformer,
                    void * pTransformArg,
                    double * padfLayerBurnValues,
                    char ** papszOptions,
                    GDALProgressFunc pfnProgress,
                    void * pProgressArg) -> CPLErr

Burn geometries from the specified list of layers into raster.

Parameters

  • hDS: output data, must be opened in update mode.
  • nBandCount: the number of bands to be updated.
  • panBandList: the list of bands to be updated.
  • nLayerCount: the number of layers being passed in pahLayers array.
  • pahLayers: the array of layers to burn in.
  • pfnTransformer: transformation to apply to geometries to put into pixel/line coordinates on raster. If NULL a geotransform based one will be created internally.
  • pTransformArg: callback data for transformer.
  • padfLayerBurnValues: the array of values to burn into the raster. There should be nBandCount values for each layer.
  • papszOptions: special options controlling rasterization:

"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. If specified, padfLayerBurnValues will not be used and can be a NULL pointer.

"CHUNKYSIZE": The height in lines of the chunk to operate on. The larger the chunk size the less times we need to make a pass through all the shapes. If it is not set or set to zero the default chunk size will be used. Default size will be estimated based on the GDAL cache buffer size using formula: cachesizebytes/scanlinesizebytes, so the chunk will not exceed the cache.

"ALL_TOUCHED": May be set to TRUE to set all pixels touched by the line or polygons, not just those whose center is within the polygon or that are selected by brezenhams line algorithm. Defaults to FALSE.

"BURNVALUEFROM": May be set to "Z" to use the Z values of the geometries. The value from padfLayerBurnValues or the attribute field value is added to this before burning. In default case dfBurnValue is burned as it is. This is implemented properly only for points and lines for now. Polygons will be burned using the Z value from the first point. The M value may be supported in the future.

"MERGE_ALG": May be REPLACE (the default) or ADD. REPLACE results in overwriting of value, while ADD adds the new value to the existing raster, suitable for heatmaps for instance.

  • pfnProgress: the progress function to report completion.
  • pProgressArg: callback data for progress function.

Returns

CENone on success or CEFailure on error.

GDAL.gdalrasterizelayersbufMethod
GDALRasterizeLayersBuf(void * pData,
                       int nBufXSize,
                       int nBufYSize,
                       GDALDataType eBufType,
                       int nPixelSpace,
                       int nLineSpace,
                       int nLayerCount,
                       OGRLayerH * pahLayers,
                       const char * pszDstProjection,
                       double * padfDstGeoTransform,
                       GDALTransformerFunc pfnTransformer,
                       void * pTransformArg,
                       double dfBurnValue,
                       char ** papszOptions,
                       GDALProgressFunc pfnProgress,
                       void * pProgressArg) -> CPLErr

Burn geometries from the specified list of layer into raster.

Parameters

  • pData: pointer to the output data array.
  • nBufXSize: width of the output data array in pixels.
  • nBufYSize: height of the output data array in pixels.
  • eBufType: data type of the output data array.
  • nPixelSpace: The byte offset from the start of one pixel value in pData to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype eBufType is used.
  • nLineSpace: The byte offset from the start of one scanline in pData to the start of the next. If defaulted the size of the datatype eBufType * nBufXSize is used.
  • nLayerCount: the number of layers being passed in pahLayers array.
  • pahLayers: the array of layers to burn in.
  • pszDstProjection: WKT defining the coordinate system of the target raster.
  • padfDstGeoTransform: geotransformation matrix of the target raster.
  • pfnTransformer: transformation to apply to geometries to put into pixel/line coordinates on raster. If NULL a geotransform based one will be created internally.
  • pTransformArg: callback data for transformer.
  • dfBurnValue: the value to burn into the raster.
  • papszOptions: special options controlling rasterization:

"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. If specified, padfLayerBurnValues will not be used and can be a NULL pointer.

"ALL_TOUCHED": May be set to TRUE to set all pixels touched by the line or polygons, not just those whose center is within the polygon or that are selected by brezenhams line algorithm. Defaults to FALSE.

"BURNVALUEFROM": May be set to "Z" to use the Z values of the geometries. dfBurnValue or the attribute field value is added to this before burning. In default case dfBurnValue is burned as it is. This is implemented properly only for points and lines for now. Polygons will be burned using the Z value from the first point. The M value may be supported in the future.

"MERGE_ALG": May be REPLACE (the default) or ADD. REPLACE results in overwriting of value, while ADD adds the new value to the existing raster, suitable for heatmaps for instance.

  • pfnProgress: the progress function to report completion.
  • pProgressArg: callback data for progress function.

Returns

CENone on success or CEFailure on error.

GDAL.gdalrasterizeoptionsfreeMethod
GDALRasterizeOptionsFree(GDALRasterizeOptions * psOptions) -> void

Frees the GDALRasterizeOptions struct.

Parameters

  • psOptions: the options struct for GDALRasterize().
GDAL.gdalrasterizeoptionsnewMethod
GDALRasterizeOptionsNew(char ** papszArgv,
                        GDALRasterizeOptionsForBinary * psOptionsForBinary) -> GDALRasterizeOptions *

Allocates a GDALRasterizeOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdal_rasterize utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALRasterizeOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALRasterizeOptions struct. Must be freed with GDALRasterizeOptionsFree().

GDAL.gdalrasterizeoptionssetprogressMethod
GDALRasterizeOptionsSetProgress(GDALRasterizeOptions * psOptions,
                                GDALProgressFunc pfnProgress,
                                void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALRasterize().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalratchangesarewrittentofileMethod
GDALRATChangesAreWrittenToFile(GDALRasterAttributeTableH hRAT) -> int

Determine whether changes made to this RAT are reflected directly in the dataset.

GDAL.gdalratcloneMethod
GDALRATClone(const GDALRasterAttributeTableH hRAT) -> GDALRasterAttributeTableH

Copy Raster Attribute Table.

GDAL.gdalratcreatecolumnMethod
GDALRATCreateColumn(GDALRasterAttributeTableH hRAT,
                    const char * pszFieldName,
                    GDALRATFieldType eFieldType,
                    GDALRATFieldUsage eFieldUsage) -> CPLErr

Create new column.

GDAL.gdalratdumpreadableMethod
GDALRATDumpReadable(GDALRasterAttributeTableH hRAT,
                    FILE * fp) -> void

Dump RAT in readable form.

GDAL.gdalratgetcolofusageMethod
GDALRATGetColOfUsage(GDALRasterAttributeTableH hRAT,
                     GDALRATFieldUsage eUsage) -> int

Fetch column index for given usage.

GDAL.gdalratgetlinearbinningMethod
GDALRATGetLinearBinning(GDALRasterAttributeTableH hRAT,
                        double * pdfRow0Min,
                        double * pdfBinSize) -> int

Get linear binning information.

GDAL.gdalratgetnameofcolMethod
GDALRATGetNameOfCol(GDALRasterAttributeTableH hRAT,
                    int iCol) -> const char *

Fetch name of indicated column.

Parameters

  • hRAT: RAT handle.
  • iCol: column index.

Returns

name.

GDAL.gdalratgetrowofvalueMethod
GDALRATGetRowOfValue(GDALRasterAttributeTableH hRAT,
                     double dfValue) -> int

Get row for pixel value.

GDAL.gdalratgettabletypeMethod
GDALRATGetTableType(GDALRasterAttributeTableH hRAT) -> GDALRATTableType

Get Rat Table Type.

GDAL.gdalratgettypeofcolMethod
GDALRATGetTypeOfCol(GDALRasterAttributeTableH hRAT,
                    int iCol) -> GDALRATFieldType

Fetch column type.

Parameters

  • hRAT: RAT handle.
  • iCol: column index.

Returns

type.

GDAL.gdalratgetusageofcolMethod
GDALRATGetUsageOfCol(GDALRasterAttributeTableH hRAT,
                     int iCol) -> GDALRATFieldUsage

Fetch column usage value.

Parameters

  • hRAT: RAT handle.
  • iCol: column index.

Returns

usage.

GDAL.gdalratgetvalueasdoubleMethod
GDALRATGetValueAsDouble(GDALRasterAttributeTableH hRAT,
                        int iRow,
                        int iField) -> double

Fetch field value as a double.

GDAL.gdalratgetvalueasintMethod
GDALRATGetValueAsInt(GDALRasterAttributeTableH hRAT,
                     int iRow,
                     int iField) -> int

Fetch field value as a integer.

GDAL.gdalratgetvalueasstringMethod
GDALRATGetValueAsString(GDALRasterAttributeTableH hRAT,
                        int iRow,
                        int iField) -> const char *

Fetch field value as a string.

GDAL.gdalratserializejsonMethod
GDALRATSerializeJSON(GDALRasterAttributeTableH hRAT) -> void *

Serialize Raster Attribute Table in Json format.

GDAL.gdalratsetlinearbinningMethod
GDALRATSetLinearBinning(GDALRasterAttributeTableH hRAT,
                        double dfRow0Min,
                        double dfBinSize) -> CPLErr

Set linear binning information.

GDAL.gdalratsetrowcountMethod
GDALRATSetRowCount(GDALRasterAttributeTableH hRAT,
                   int nNewCount) -> void

Set row count.

Parameters

  • hRAT: RAT handle.
  • nNewCount: the new number of rows.
GDAL.gdalratsettabletypeMethod
GDALRATSetTableType(GDALRasterAttributeTableH hRAT,
                    const GDALRATTableType eInTableType) -> CPLErr

Set RAT Table Type.

GDAL.gdalratsetvalueasdoubleMethod
GDALRATSetValueAsDouble(GDALRasterAttributeTableH hRAT,
                        int iRow,
                        int iField,
                        double dfValue) -> void

Set field value from double.

GDAL.gdalratsetvalueasintMethod
GDALRATSetValueAsInt(GDALRasterAttributeTableH hRAT,
                     int iRow,
                     int iField,
                     int nValue) -> void

Set field value from integer.

GDAL.gdalratsetvalueasstringMethod
GDALRATSetValueAsString(GDALRasterAttributeTableH hRAT,
                        int iRow,
                        int iField,
                        const char * pszValue) -> void

Set field value from string.

Parameters

  • hRAT: RAT handle.
  • iRow: row index.
  • iField: field index.
  • pszValue: value.
GDAL.gdalrattranslatetocolortableMethod
GDALRATTranslateToColorTable(GDALRasterAttributeTableH hRAT,
                             int nEntryCount) -> GDALColorTableH

Translate to a color table.

GDAL.gdalratvaluesioasdoubleMethod
GDALRATValuesIOAsDouble(GDALRasterAttributeTableH hRAT,
                        GDALRWFlag eRWFlag,
                        int iField,
                        int iStartRow,
                        int iLength,
                        double * pdfData) -> CPLErr

Read or Write a block of doubles to/from the Attribute Table.

GDAL.gdalratvaluesioasintegerMethod
GDALRATValuesIOAsInteger(GDALRasterAttributeTableH hRAT,
                         GDALRWFlag eRWFlag,
                         int iField,
                         int iStartRow,
                         int iLength,
                         int * pnData) -> CPLErr

Read or Write a block of ints to/from the Attribute Table.

GDAL.gdalratvaluesioasstringMethod
GDALRATValuesIOAsString(GDALRasterAttributeTableH hRAT,
                        GDALRWFlag eRWFlag,
                        int iField,
                        int iStartRow,
                        int iLength,
                        CSLConstList papszStrList) -> CPLErr

Read or Write a block of strings to/from the Attribute Table.

GDAL.gdalreadblockMethod
GDALReadBlock(GDALRasterBandH hBand,
              int nXOff,
              int nYOff,
              void * pData) -> CPLErr

Read a block of image data efficiently.

GDAL.gdalreadozimapfileMethod
GDALReadOziMapFile(const char * pszBaseFilename,
                   double * padfGeoTransform,
                   char ** ppszWKT,
                   int * pnGCPCount,
                   GDAL_GCP ** ppasGCPs) -> int

Helper function for translator implementer wanting support for OZI .map.

Parameters

  • pszBaseFilename: filename whose basename will help building the .map filename.
  • padfGeoTransform: output geotransform. Must hold 6 doubles.
  • ppszWKT: output pointer to a string that will be allocated with CPLMalloc().
  • pnGCPCount: output pointer to GCP count.
  • ppasGCPs: outputer pointer to an array of GCPs.

Returns

TRUE in case of success, FALSE otherwise.

GDAL.gdalreadtabfileMethod
GDALReadTabFile(const char * pszBaseFilename,
                double * padfGeoTransform,
                char ** ppszWKT,
                int * pnGCPCount,
                GDAL_GCP ** ppasGCPs) -> int

Helper function for translator implementer wanting support for MapInfo .tab files.

Parameters

  • pszBaseFilename: filename whose basename will help building the .tab filename.
  • padfGeoTransform: output geotransform. Must hold 6 doubles.
  • ppszWKT: output pointer to a string that will be allocated with CPLMalloc().
  • pnGCPCount: output pointer to GCP count.
  • ppasGCPs: outputer pointer to an array of GCPs.

Returns

TRUE in case of success, FALSE otherwise.

GDAL.gdalreadworldfileMethod
GDALReadWorldFile(const char * pszBaseFilename,
                  const char * pszExtension,
                  double * padfGeoTransform) -> int

Read ESRI world file.

Parameters

  • pszBaseFilename: the target raster file.
  • pszExtension: the extension to use (i.e. "wld") or NULL to derive it from the pszBaseFilename
  • padfGeoTransform: the six double array into which the geotransformation should be placed.

Returns

TRUE on success or FALSE on failure.

GDAL.gdalregenerateoverviewsMethod
GDALRegenerateOverviews(GDALRasterBandH hSrcBand,
                        int nOverviewCount,
                        GDALRasterBandH * pahOvrBands,
                        const char * pszResampling,
                        GDALProgressFunc pfnProgress,
                        void * pProgressData) -> CPLErr

Generate downsampled overviews.

Parameters

  • hSrcBand: the source (base level) band.
  • nOverviewCount: the number of downsampled bands being generated.
  • pahOvrBands: the list of downsampled bands to be generated.
  • pszResampling: Resampling algorithm (e.g. "AVERAGE").
  • pfnProgress: progress report function.
  • pProgressData: progress function callback data.

Returns

CENone on success or CEFailure on failure.

GDAL.gdalregenerateoverviewsexMethod
GDALRegenerateOverviewsEx(GDALRasterBandH hSrcBand,
                          int nOverviewCount,
                          GDALRasterBandH * pahOvrBands,
                          const char * pszResampling,
                          GDALProgressFunc pfnProgress,
                          void * pProgressData,
                          CSLConstList papszOptions) -> CPLErr

Generate downsampled overviews.

Parameters

  • hSrcBand: the source (base level) band.
  • nOverviewCount: the number of downsampled bands being generated.
  • pahOvrBands: the list of downsampled bands to be generated.
  • pszResampling: Resampling algorithm (e.g. "AVERAGE").
  • pfnProgress: progress report function.
  • pProgressData: progress function callback data.
  • papszOptions: NULL terminated list of options as key=value pairs, or NULL

Returns

CENone on success or CEFailure on failure.

GDAL.gdalrelationshipcreateMethod
GDALRelationshipCreate(const char * pszName,
                       const char * pszLeftTableName,
                       const char * pszRightTableName,
                       GDALRelationshipCardinality eCardinality) -> GDALRelationshipH

Creates a new relationship.

Parameters

  • pszName: relationship name
  • pszLeftTableName: left table name
  • pszRightTableName: right table name
  • eCardinality: cardinality of relationship

Returns

a new handle that should be freed with GDALDestroyRelationship(), or NULL in case of error.

GDAL.gdalrelationshipgetbackwardpathlabelMethod
GDALRelationshipGetBackwardPathLabel(GDALRelationshipH hRelationship) -> const char *

Get the label of the backward path for the relationship.

Returns

backward path label

GDAL.gdalrelationshipgetcardinalityMethod
GDALRelationshipGetCardinality(GDALRelationshipH hRelationship) -> GDALRelationshipCardinality

Get the cardinality of the relationship.

Returns

cardinality.

GDAL.gdalrelationshipgetforwardpathlabelMethod
GDALRelationshipGetForwardPathLabel(GDALRelationshipH hRelationship) -> const char *

Get the label of the forward path for the relationship.

Returns

forward path label

GDAL.gdalrelationshipgetleftmappingtablefieldsMethod
GDALRelationshipGetLeftMappingTableFields(GDALRelationshipH hRelationship) -> char **

Get the names of the mapping table fields which correspond to the participating fields from the left table in the relationship.

Returns

the field names, to be freed with CSLDestroy()

GDAL.gdalrelationshipgetlefttablefieldsMethod
GDALRelationshipGetLeftTableFields(GDALRelationshipH hRelationship) -> char **

Get the names of the participating fields from the left table in the relationship.

Returns

the field names, to be freed with CSLDestroy()

GDAL.gdalrelationshipgetlefttablenameMethod
GDALRelationshipGetLeftTableName(GDALRelationshipH hRelationship) -> const char *

Get the name of the left (or base/origin) table in the relationship.

Returns

left table name.

GDAL.gdalrelationshipgetmappingtablenameMethod
GDALRelationshipGetMappingTableName(GDALRelationshipH hRelationship) -> const char *

Get the name of the mapping table for many-to-many relationships.

Returns

mapping table name.

GDAL.gdalrelationshipgetnameMethod
GDALRelationshipGetName(GDALRelationshipH hRelationship) -> const char *

Get the name of the relationship.

Returns

name.

GDAL.gdalrelationshipgetrelatedtabletypeMethod
GDALRelationshipGetRelatedTableType(GDALRelationshipH hRelationship) -> const char *

Get the type string of the related table.

Returns

related table type

GDAL.gdalrelationshipgetrightmappingtablefieldsMethod
GDALRelationshipGetRightMappingTableFields(GDALRelationshipH hRelationship) -> char **

Get the names of the mapping table fields which correspond to the participating fields from the right table in the relationship.

Returns

the field names, to be freed with CSLDestroy()

GDAL.gdalrelationshipgetrighttablefieldsMethod
GDALRelationshipGetRightTableFields(GDALRelationshipH hRelationship) -> char **

Get the names of the participating fields from the right table in the relationship.

Returns

the field names, to be freed with CSLDestroy()

GDAL.gdalrelationshipgetrighttablenameMethod
GDALRelationshipGetRightTableName(GDALRelationshipH hRelationship) -> const char *

Get the name of the right (or related/destination) table in the relationship.

Returns

right table name.

GDAL.gdalrelationshipgettypeMethod
GDALRelationshipGetType(GDALRelationshipH hRelationship) -> GDALRelationshipType

Get the type of the relationship.

Returns

relationship type.

GDAL.gdalrelationshipsetbackwardpathlabelMethod
GDALRelationshipSetBackwardPathLabel(GDALRelationshipH hRelationship,
                                     const char * pszLabel) -> void

Sets the label of the backward path for the relationship.

Parameters

  • hRelationship: handle to the relationship to apply the new label to.
  • pszLabel: the label to set.
GDAL.gdalrelationshipsetforwardpathlabelMethod
GDALRelationshipSetForwardPathLabel(GDALRelationshipH hRelationship,
                                    const char * pszLabel) -> void

Sets the label of the forward path for the relationship.

Parameters

  • hRelationship: handle to the relationship to apply the new label to.
  • pszLabel: the label to set.
GDAL.gdalrelationshipsetleftmappingtablefieldsMethod
GDALRelationshipSetLeftMappingTableFields(GDALRelationshipH hRelationship,
                                          CSLConstList papszFields) -> void

Sets the names of the mapping table fields which correspond to the participating fields from the left table in the relationship.

Parameters

  • hRelationship: handle to the relationship to apply the left table fields to.
  • papszFields: the names of the fields.
GDAL.gdalrelationshipsetlefttablefieldsMethod
GDALRelationshipSetLeftTableFields(GDALRelationshipH hRelationship,
                                   CSLConstList papszFields) -> void

Sets the names of the participating fields from the left table in the relationship.

Parameters

  • hRelationship: handle to the relationship to apply the left table fields to.
  • papszFields: the names of the fields.
GDAL.gdalrelationshipsetmappingtablenameMethod
GDALRelationshipSetMappingTableName(GDALRelationshipH hRelationship,
                                    const char * pszName) -> void

Sets the name of the mapping table for many-to-many relationships.

Parameters

  • hRelationship: handle to the relationship to apply the new mapping name to.
  • pszName: the mapping table name to set.
GDAL.gdalrelationshipsetrelatedtabletypeMethod
GDALRelationshipSetRelatedTableType(GDALRelationshipH hRelationship,
                                    const char * pszType) -> void

Sets the type string of the related table.

Parameters

  • hRelationship: handle to the relationship to apply the new type to.
  • pszType: the type to set.
GDAL.gdalrelationshipsetrightmappingtablefieldsMethod
GDALRelationshipSetRightMappingTableFields(GDALRelationshipH hRelationship,
                                           CSLConstList papszFields) -> void

Sets the names of the mapping table fields which correspond to the participating fields from the right table in the relationship.

Parameters

  • hRelationship: handle to the relationship to apply the right table fields to.
  • papszFields: the names of the fields.
GDAL.gdalrelationshipsetrighttablefieldsMethod
GDALRelationshipSetRightTableFields(GDALRelationshipH hRelationship,
                                    CSLConstList papszFields) -> void

Sets the names of the participating fields from the right table in the relationship.

Parameters

  • hRelationship: handle to the relationship to apply the right table fields to.
  • papszFields: the names of the fields.
GDAL.gdalrelationshipsettypeMethod
GDALRelationshipSetType(GDALRelationshipH hRelationship,
                        GDALRelationshipType eType) -> void

Sets the type of the relationship.

GDAL.gdalreleasearraysMethod
GDALReleaseArrays(GDALMDArrayH * arrays,
                  size_t nCount) -> void

Free the return of GDALMDArrayGetCoordinateVariables()

Parameters

  • arrays: return pointer of above methods
  • nCount: *pnCount value returned by above methods
GDAL.gdalreleaseattributesMethod
GDALReleaseAttributes(GDALAttributeH * attributes,
                      size_t nCount) -> void

Free the return of GDALGroupGetAttributes() or GDALMDArrayGetAttributes()

Parameters

  • attributes: return pointer of above methods
  • nCount: *pnCount value returned by above methods
GDAL.gdalreleasedatasetMethod
GDALReleaseDataset(GDALDatasetH hDataset) -> int

Drop a reference to this object, and destroy if no longer referenced.

GDAL.gdalreleasedimensionsMethod
GDALReleaseDimensions(GDALDimensionH * dims,
                      size_t nCount) -> void

Free the return of GDALGroupGetDimensions() or GDALMDArrayGetDimensions()

Parameters

  • dims: return pointer of above methods
  • nCount: *pnCount value returned by above methods
GDAL.gdalrenamedatasetMethod
GDALRenameDataset(GDALDriverH hDriver,
                  const char * pszNewName,
                  const char * pszOldName) -> CPLErr

Rename a dataset.

GDAL.gdalreprojectimageMethod
gdalreprojectimage(hSrcDS, pszSrcWKT, hDstDS, pszDstWKT, eResampleAlg, dfWarpMemoryLimit, dfMaxError, pfnProgress, pProgressArg, psOptions)

GDAL.gdalreprojectiontransformMethod
GDALReprojectionTransform(void * pTransformArg,
                          int bDstToSrc,
                          int nPointCount,
                          double * padfX,
                          double * padfY,
                          double * padfZ,
                          int * panSuccess) -> int

Perform reprojection transformation.

GDAL.gdalrpctransformMethod
GDALRPCTransform(void * pTransformArg,
                 int bDstToSrc,
                 int nPointCount,
                 double * padfX,
                 double * padfY,
                 double * padfZ,
                 int * panSuccess) -> int

RPC transform.

GDAL.gdalscaledprogressMethod
GDALScaledProgress(double dfComplete,
                   const char * pszMessage,
                   void * pData) -> int

Scaled progress transformer.

GDAL.gdalsetcachemaxMethod
GDALSetCacheMax(int nNewSizeInBytes) -> void

Set maximum cache memory.

Parameters

  • nNewSizeInBytes: the maximum number of bytes for caching.
GDAL.gdalsetcachemax64Method
GDALSetCacheMax64(GIntBig nNewSizeInBytes) -> void

Set maximum cache memory.

Parameters

  • nNewSizeInBytes: the maximum number of bytes for caching.
GDAL.gdalsetcolorentryMethod
GDALSetColorEntry(GDALColorTableH hTable,
                  int i,
                  const GDALColorEntry * poEntry) -> void

Set entry in color table.

GDAL.gdalsetdefaulthistogramMethod
GDALSetDefaultHistogram(GDALRasterBandH hBand,
                        double dfMin,
                        double dfMax,
                        int nBuckets,
                        int * panHistogram) -> CPLErr

Set default histogram.

GDAL.gdalsetdefaulthistogramexMethod
GDALSetDefaultHistogramEx(GDALRasterBandH hBand,
                          double dfMin,
                          double dfMax,
                          int nBuckets,
                          GUIntBig * panHistogram) -> CPLErr

Set default histogram.

GDAL.gdalsetdefaultratMethod
GDALSetDefaultRAT(GDALRasterBandH hBand,
                  GDALRasterAttributeTableH hRAT) -> CPLErr

Set default Raster Attribute Table.

GDAL.gdalsetdescriptionMethod
GDALSetDescription(GDALMajorObjectH hObject,
                   const char * pszNewDesc) -> void

Set object description.

GDAL.gdalsetgcpsMethod
GDALSetGCPs(GDALDatasetH hDS,
            int nGCPCount,
            const GDAL_GCP * pasGCPList,
            const char * pszGCPProjection) -> CPLErr

Assign GCPs.

GDAL.gdalsetgcps2Method
GDALSetGCPs2(GDALDatasetH hDS,
             int nGCPCount,
             const GDAL_GCP * pasGCPList,
             OGRSpatialReferenceH hSRS) -> CPLErr

Assign GCPs.

GDAL.gdalsetgenimgprojtransformerdstgeotransformMethod
GDALSetGenImgProjTransformerDstGeoTransform(void * hTransformArg,
                                            const double * padfGeoTransform) -> void

Set GenImgProj output geotransform.

Parameters

  • hTransformArg: the handle to update.
  • padfGeoTransform: the destination geotransform to apply (six doubles).
GDAL.gdalsetgeotransformMethod
GDALSetGeoTransform(GDALDatasetH hDS,
                    double * padfTransform) -> CPLErr

Set the affine transformation coefficients.

GDAL.gdalsetmetadataMethod
GDALSetMetadata(GDALMajorObjectH hObject,
                CSLConstList papszMD,
                const char * pszDomain) -> CPLErr

Set metadata.

GDAL.gdalsetmetadataitemMethod
GDALSetMetadataItem(GDALMajorObjectH hObject,
                    const char * pszName,
                    const char * pszValue,
                    const char * pszDomain) -> CPLErr

Set single metadata item.

GDAL.gdalsetprojectionMethod
GDALSetProjection(GDALDatasetH hDS,
                  const char * pszProjection) -> CPLErr

Set the projection reference string for this dataset.

GDAL.gdalsetrastercategorynamesMethod
GDALSetRasterCategoryNames(GDALRasterBandH hBand,
                           CSLConstList papszNames) -> CPLErr

Set the category names for this band.

GDAL.gdalsetrastercolortableMethod
GDALSetRasterColorTable(GDALRasterBandH hBand,
                        GDALColorTableH hCT) -> CPLErr

Set the raster color table.

GDAL.gdalsetrasternodatavalueMethod
GDALSetRasterNoDataValue(GDALRasterBandH hBand,
                         double dfValue) -> CPLErr

Set the no data value for this band.

GDAL.gdalsetrasteroffsetMethod
GDALSetRasterOffset(GDALRasterBandH hBand,
                    double dfNewOffset) -> CPLErr

Set scaling offset.

GDAL.gdalsetrasterscaleMethod
GDALSetRasterScale(GDALRasterBandH hBand,
                   double dfNewOffset) -> CPLErr

Set scaling ratio.

GDAL.gdalsetrasterstatisticsMethod
GDALSetRasterStatistics(GDALRasterBandH hBand,
                        double dfMin,
                        double dfMax,
                        double dfMean,
                        double dfStdDev) -> CPLErr

Set statistics on band.

GDAL.gdalsetrasterunittypeMethod
GDALSetRasterUnitType(GDALRasterBandH hBand,
                      const char * pszNewValue) -> CPLErr

Set unit type.

GDAL.gdalsetspatialrefMethod
GDALSetSpatialRef(GDALDatasetH hDS,
                  OGRSpatialReferenceH hSRS) -> CPLErr

Set the spatial reference system for this dataset.

GDAL.gdalsettransformerdstgeotransformMethod
GDALSetTransformerDstGeoTransform(void * pTransformArg,
                                  const double * padfGeoTransform) -> void

Set ApproxTransformer or GenImgProj output geotransform.

Parameters

  • pTransformArg: the handle to update.
  • padfGeoTransform: the destination geotransform to apply (six doubles).
GDAL.gdalsievefilterMethod
GDALSieveFilter(GDALRasterBandH hSrcBand,
                GDALRasterBandH hMaskBand,
                GDALRasterBandH hDstBand,
                int nSizeThreshold,
                int nConnectedness,
                char ** papszOptions,
                GDALProgressFunc pfnProgress,
                void * pProgressArg) -> CPLErr

Removes small raster polygons.

Parameters

  • hSrcBand: the source raster band to be processed.
  • hMaskBand: an optional mask band. All pixels in the mask band with a value other than zero will be considered suitable for inclusion in polygons.
  • hDstBand: the output raster band. It may be the same as hSrcBand to update the source in place.
  • nSizeThreshold: raster polygons with sizes smaller than this will be merged into their largest neighbour.
  • nConnectedness: either 4 indicating that diagonal pixels are not considered directly adjacent for polygon membership purposes or 8 indicating they are.
  • papszOptions: algorithm options in name=value list form. None currently supported.
  • pfnProgress: callback for reporting algorithm progress matching the GDALProgressFunc() semantics. May be NULL.
  • pProgressArg: callback argument passed to pfnProgress.

Returns

CENone on success or CEFailure if an error occurs.

GDAL.gdalsimpleimagewarpMethod
GDALSimpleImageWarp(GDALDatasetH hSrcDS,
                    GDALDatasetH hDstDS,
                    int nBandCount,
                    int * panBandList,
                    GDALTransformerFunc pfnTransform,
                    void * pTransformArg,
                    GDALProgressFunc pfnProgress,
                    void * pProgressArg,
                    char ** papszWarpOptions) -> int

Perform simple image warp.

Parameters

  • hSrcDS: the source image dataset.
  • hDstDS: the destination image dataset.
  • nBandCount: the number of bands to be warped. If zero, all bands will be processed.
  • panBandList: the list of bands to translate.
  • pfnTransform: the transformation function to call. See GDALTransformerFunc().
  • pTransformArg: the callback handle to pass to pfnTransform.
  • pfnProgress: the function used to report progress. See GDALProgressFunc().
  • pProgressArg: the callback handle to pass to pfnProgress.
  • papszWarpOptions: additional options controlling the warp.

Returns

TRUE if the operation completes, or FALSE if an error occurs.

GDAL.gdalsuggestedwarpoutputMethod
GDALSuggestedWarpOutput(GDALDatasetH hSrcDS,
                        GDALTransformerFunc pfnTransformer,
                        void * pTransformArg,
                        double * padfGeoTransformOut,
                        int * pnPixels,
                        int * pnLines) -> CPLErr

Suggest output file size.

Parameters

  • hSrcDS: the input image (it is assumed the whole input image is being transformed).
  • pfnTransformer: the transformer function.
  • pTransformArg: the callback data for the transformer function.
  • padfGeoTransformOut: the array of six doubles in which the suggested geotransform is returned.
  • pnPixels: int in which the suggest pixel width of output is returned.
  • pnLines: int in which the suggest pixel height of output is returned.

Returns

CENone if successful or CEFailure otherwise.

GDAL.gdalsuggestedwarpoutput2Method
GDALSuggestedWarpOutput2(GDALDatasetH hSrcDS,
                         GDALTransformerFunc pfnTransformer,
                         void * pTransformArg,
                         double * padfGeoTransformOut,
                         int * pnPixels,
                         int * pnLines,
                         double * padfExtent,
                         int nOptions) -> CPLErr

Suggest output file size.

Parameters

  • hSrcDS: the input image (it is assumed the whole input image is being transformed).
  • pfnTransformer: the transformer function.
  • pTransformArg: the callback data for the transformer function.
  • padfGeoTransformOut: the array of six doubles in which the suggested geotransform is returned.
  • pnPixels: int in which the suggest pixel width of output is returned.
  • pnLines: int in which the suggest pixel height of output is returned.
  • padfExtent: Four entry array to return extents as (xmin, ymin, xmax, ymax).
  • nOptions: Options. Zero or GDALSWOROUNDUPSIZE to ask *pnPixels and *pnLines to be rounded up instead of being rounded to the closes integer.

Returns

CENone if successful or CEFailure otherwise.

GDAL.gdalswapwordsMethod
GDALSwapWords(void * pData,
              int nWordSize,
              int nWordCount,
              int nWordSkip) -> void

Byte swap words in-place.

Parameters

  • pData: pointer to start of data buffer.
  • nWordSize: size of words being swapped in bytes. Normally 2, 4 or 8.
  • nWordCount: the number of words to be swapped in this call.
  • nWordSkip: the byte offset from the start of one word to the start of the next. For packed buffers this is the same as nWordSize.
GDAL.gdalswapwordsexMethod
GDALSwapWordsEx(void * pData,
                int nWordSize,
                size_t nWordCount,
                int nWordSkip) -> void

Byte swap words in-place.

Parameters

  • pData: pointer to start of data buffer.
  • nWordSize: size of words being swapped in bytes. Normally 2, 4 or 8.
  • nWordCount: the number of words to be swapped in this call.
  • nWordSkip: the byte offset from the start of one word to the start of the next. For packed buffers this is the same as nWordSize.
GDAL.gdaltermprogressMethod
GDALTermProgress(double dfComplete,
                 const char * pszMessage,
                 void * pProgressArg) -> int

Simple progress report to terminal.

Parameters

  • dfComplete: completion ratio from 0.0 to 1.0.
  • pszMessage: optional message.
  • pProgressArg: ignored callback data argument.

Returns

Always returns TRUE indicating the process should continue.

GDAL.gdaltpstransformMethod
GDALTPSTransform(void * pTransformArg,
                 int bDstToSrc,
                 int nPointCount,
                 double * x,
                 double * y,
                 double * z,
                 int * panSuccess) -> int

Transforms point based on GCP derived polynomial model.

Parameters

  • pTransformArg: return value from GDALCreateTPSTransformer().
  • bDstToSrc: TRUE if transformation is from the destination (georeferenced) coordinates to pixel/line or FALSE when transforming from pixel/line to georeferenced coordinates.
  • nPointCount: the number of values in the x, y and z arrays.
  • x: array containing the X values to be transformed.
  • y: array containing the Y values to be transformed.
  • z: array containing the Z values to be transformed.
  • panSuccess: array in which a flag indicating success (TRUE) or failure (FALSE) of the transformation are placed.

Returns

TRUE.

GDAL.gdaltransformgeolocationsMethod
gdaltransformgeolocations(hXBand, hYBand, hZBand, pfnTransformer, pTransformArg, pfnProgress, pProgressArg, papszOptions)

GDAL.gdaltranslateMethod
GDALTranslate(const char * pszDest,
              GDALDatasetH hSrcDataset,
              const GDALTranslateOptions * psOptionsIn,
              int * pbUsageError) -> GDALDatasetH

Converts raster data between different formats.

Parameters

  • pszDest: the destination dataset path.
  • hSrcDataset: the source dataset handle.
  • psOptionsIn: the options struct returned by GDALTranslateOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose()) or NULL in case of error.

GDAL.gdaltranslateoptionsfreeMethod
GDALTranslateOptionsFree(GDALTranslateOptions * psOptions) -> void

Frees the GDALTranslateOptions struct.

Parameters

  • psOptions: the options struct for GDALTranslate().
GDAL.gdaltranslateoptionsnewMethod
GDALTranslateOptionsNew(char ** papszArgv,
                        GDALTranslateOptionsForBinary * psOptionsForBinary) -> GDALTranslateOptions *

Allocates a GDALTranslateOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdal_translate utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALTranslateOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALTranslateOptions struct. Must be freed with GDALTranslateOptionsFree().

GDAL.gdaltranslateoptionssetprogressMethod
GDALTranslateOptionsSetProgress(GDALTranslateOptions * psOptions,
                                GDALProgressFunc pfnProgress,
                                void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALTranslate().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdaltriangulationcomputebarycentriccoefficientsMethod
GDALTriangulationComputeBarycentricCoefficients(GDALTriangulation * psDT,
                                                const double * padfX,
                                                const double * padfY) -> int

Computes barycentric coefficients for each triangles of the triangulation.

Parameters

  • psDT: triangulation.
  • padfX: x coordinates of the points. Must be identical to the one passed to GDALTriangulationCreateDelaunay().
  • padfY: y coordinates of the points. Must be identical to the one passed to GDALTriangulationCreateDelaunay().

Returns

TRUE in case of success.

GDAL.gdaltriangulationcomputebarycentriccoordinatesMethod
GDALTriangulationComputeBarycentricCoordinates(const GDALTriangulation * psDT,
                                               int nFacetIdx,
                                               double dfX,
                                               double dfY,
                                               double * pdfL1,
                                               double * pdfL2,
                                               double * pdfL3) -> int

Computes the barycentric coordinates of a point.

Parameters

  • psDT: triangulation.
  • nFacetIdx: index of the triangle in the triangulation
  • dfX: x coordinate of the point.
  • dfY: y coordinate of the point.
  • pdfL1: (output) pointer to the 1st barycentric coordinate.
  • pdfL2: (output) pointer to the 2nd barycentric coordinate.
  • pdfL3: (output) pointer to the 2nd barycentric coordinate.

Returns

TRUE in case of success.

GDAL.gdaltriangulationcreatedelaunayMethod
GDALTriangulationCreateDelaunay(int nPoints,
                                const double * padfX,
                                const double * padfY) -> GDALTriangulation *

Computes a Delaunay triangulation of the passed points.

Parameters

  • nPoints: number of points
  • padfX: x coordinates of the points.
  • padfY: y coordinates of the points.

Returns

triangulation that must be freed with GDALTriangulationFree(), or NULL in case of error.

GDAL.gdaltriangulationfindfacetbruteforceMethod
GDALTriangulationFindFacetBruteForce(const GDALTriangulation * psDT,
                                     double dfX,
                                     double dfY,
                                     int * panOutputFacetIdx) -> int

Returns the index of the triangle that contains the point by iterating over all triangles.

Parameters

  • psDT: triangulation.
  • dfX: x coordinate of the point.
  • dfY: y coordinate of the point.
  • panOutputFacetIdx: (output) pointer to the index of the triangle, or -1 in case of failure.

Returns

index >= 0 of the triangle in case of success, -1 otherwise.

GDAL.gdaltriangulationfindfacetdirectedMethod
GDALTriangulationFindFacetDirected(const GDALTriangulation * psDT,
                                   int nFacetIdx,
                                   double dfX,
                                   double dfY,
                                   int * panOutputFacetIdx) -> int

Returns the index of the triangle that contains the point by walking in the triangulation.

Parameters

  • psDT: triangulation.
  • nFacetIdx: index of first triangle to start with. Must be >= 0 && < psDT->nFacets
  • dfX: x coordinate of the point.
  • dfY: y coordinate of the point.
  • panOutputFacetIdx: (output) pointer to the index of the triangle, or -1 in case of failure.

Returns

TRUE in case of success, FALSE otherwise.

GDAL.gdaltriangulationfreeMethod
GDALTriangulationFree(GDALTriangulation * psDT) -> void

Free a triangulation.

Parameters

  • psDT: triangulation.
GDAL.gdalusetransformerMethod
GDALUseTransformer(void * pTransformArg,
                   int bDstToSrc,
                   int nPointCount,
                   double * x,
                   double * y,
                   double * z,
                   int * panSuccess) -> int
GDAL.gdalvalidatecreationoptionsMethod
GDALValidateCreationOptions(GDALDriverH hDriver,
                            CSLConstList papszCreationOptions) -> int

Validate the list of creation options that are handled by a driver.

Parameters

  • hDriver: the handle of the driver with whom the lists of creation option must be validated
  • papszCreationOptions: the list of creation options. An array of strings, whose last element is a NULL pointer

Returns

TRUE if the list of creation options is compatible with the Create() and CreateCopy() method of the driver, FALSE otherwise.

GDAL.gdalvectorinfoMethod
GDALVectorInfo(GDALDatasetH hDataset,
               const GDALVectorInfoOptions * psOptions) -> char *

Lists various information about a GDAL supported vector dataset.

Parameters

  • hDataset: the dataset handle.
  • psOptions: the options structure returned by GDALVectorInfoOptionsNew() or NULL.

Returns

string corresponding to the information about the raster dataset (must be freed with CPLFree()), or NULL in case of error.

GDAL.gdalvectorinfooptionsfreeMethod
GDALVectorInfoOptionsFree(GDALVectorInfoOptions * psOptions) -> void

Frees the GDALVectorInfoOptions struct.

Parameters

  • psOptions: the options struct for GDALVectorInfo().
GDAL.gdalvectorinfooptionsnewMethod
GDALVectorInfoOptionsNew(char ** papszArgv,
                         GDALVectorInfoOptionsForBinary * psOptionsForBinary) -> GDALVectorInfoOptions *

Allocates a GDALVectorInfoOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the ogrinfo utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (ogrinfo_bin.cpp use case) must be allocated with GDALVectorInfoOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options, subdataset number...

Returns

pointer to the allocated GDALVectorInfoOptions struct. Must be freed with GDALVectorInfoOptionsFree().

GDAL.gdalvectortranslateMethod
GDALVectorTranslate(const char * pszDest,
                    GDALDatasetH hDstDS,
                    int nSrcCount,
                    GDALDatasetH * pahSrcDS,
                    const GDALVectorTranslateOptions * psOptionsIn,
                    int * pbUsageError) -> GDALDatasetH

Converts vector data between file formats.

Parameters

  • pszDest: the destination dataset path or NULL.
  • hDstDS: the destination dataset or NULL.
  • nSrcCount: the number of input datasets (only 1 supported currently)
  • pahSrcDS: the list of input datasets.
  • psOptionsIn: the options struct returned by GDALVectorTranslateOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred, or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose(), or hDstDS is not NULL) or NULL in case of error.

GDAL.gdalvectortranslateoptionsfreeMethod
GDALVectorTranslateOptionsFree(GDALVectorTranslateOptions * psOptions) -> void

Frees the GDALVectorTranslateOptions struct.

Parameters

  • psOptions: the options struct for GDALVectorTranslate().
GDAL.gdalvectortranslateoptionsnewMethod
GDALVectorTranslateOptionsNew(char ** papszArgv,
                              GDALVectorTranslateOptionsForBinary * psOptionsForBinary) -> GDALVectorTranslateOptions *

allocates a GDALVectorTranslateOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the ogr2ogr utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALVectorTranslateOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALVectorTranslateOptions struct. Must be freed with GDALVectorTranslateOptionsFree().

GDAL.gdalvectortranslateoptionssetprogressMethod
GDALVectorTranslateOptionsSetProgress(GDALVectorTranslateOptions * psOptions,
                                      GDALProgressFunc pfnProgress,
                                      void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALVectorTranslate().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalversioninfoMethod
GDALVersionInfo(const char * pszRequest) -> const char *

Get runtime version information.

Parameters

  • pszRequest: the type of version info desired, as listed above.

Returns

an internal string containing the requested information.

GDAL.gdalviewshedgenerateMethod
GDALViewshedGenerate(GDALRasterBandH hBand,
                     const char * pszDriverName,
                     const char * pszTargetRasterName,
                     CSLConstList papszCreationOptions,
                     double dfObserverX,
                     double dfObserverY,
                     double dfObserverHeight,
                     double dfTargetHeight,
                     double dfVisibleVal,
                     double dfInvisibleVal,
                     double dfOutOfRangeVal,
                     double dfNoDataVal,
                     double dfCurvCoeff,
                     GDALViewshedMode eMode,
                     double dfMaxDistance,
                     GDALProgressFunc pfnProgress,
                     void * pProgressArg,
                     GDALViewshedOutputType heightMode,
                     CSLConstList papszExtraOptions) -> GDALDatasetH

Create viewshed from raster DEM.

Parameters

  • hBand: The band to read the DEM data from. Only the part of the raster within the specified maxdistance around the observer point is processed.
  • pszDriverName: Driver name (GTiff if set to NULL)
  • pszTargetRasterName: The name of the target raster to be generated. Must not be NULL
  • papszCreationOptions: creation options.
  • dfObserverX: observer X value (in SRS units)
  • dfObserverY: observer Y value (in SRS units)
  • dfObserverHeight: The height of the observer above the DEM surface.
  • dfTargetHeight: The height of the target above the DEM surface. (default 0)
  • dfVisibleVal: pixel value for visibility (default 255)
  • dfInvisibleVal: pixel value for invisibility (default 0)
  • dfOutOfRangeVal: The value to be set for the cells that fall outside of the range specified by dfMaxDistance.
  • dfNoDataVal: The value to be set for the cells that have no data. If set to a negative value, nodata is not set. Note: currently, no special processing of input cells at a nodata value is done (which may result in erroneous results).
  • dfCurvCoeff: Coefficient to consider the effect of the curvature and refraction. The height of the DEM is corrected according to the following formula: [Height] -= dfCurvCoeff * [Target Distance]^2 / [Earth Diameter] For the effect of the atmospheric refraction we can use 0.85714.
  • eMode: The mode of the viewshed calculation. Possible values GVMDiagonal = 1, GVMEdge = 2 (default), GVMMax = 3, GVMMin = 4.
  • dfMaxDistance: maximum distance range to compute viewshed. It is also used to clamp the extent of the output raster. If set to 0, then unlimited range is assumed, that is to say the computation is performed on the extent of the whole raster.
  • pfnProgress: A GDALProgressFunc that may be used to report progress to the user, or to interrupt the algorithm. May be NULL if not required.
  • pProgressArg: The callback data for the pfnProgress function.
  • heightMode: Type of information contained in output raster. Possible values GVOTNORMAL = 1 (default), GVOTMINTARGETHEIGHTFROMDEM = 2, GVOTMINTARGETHEIGHTFROM_GROUND = 3
  • papszExtraOptions: Future extra options. Must be set to NULL currently.

Returns

not NULL output dataset on success (to be closed with GDALClose()) or NULL if an error occurs.

GDAL.gdalwarpMethod
GDALWarp(const char * pszDest,
         GDALDatasetH hDstDS,
         int nSrcCount,
         GDALDatasetH * pahSrcDS,
         const GDALWarpAppOptions * psOptionsIn,
         int * pbUsageError) -> GDALDatasetH

Image reprojection and warping function.

Parameters

  • pszDest: the destination dataset path or NULL.
  • hDstDS: the destination dataset or NULL.
  • nSrcCount: the number of input datasets.
  • pahSrcDS: the list of input datasets.
  • psOptionsIn: the options struct returned by GDALWarpAppOptionsNew() or NULL.
  • pbUsageError: pointer to a integer output variable to store if any usage error has occurred, or NULL.

Returns

the output dataset (new dataset that must be closed using GDALClose(), or hDstDS if not NULL) or NULL in case of error.

GDAL.gdalwarpappoptionsfreeMethod
GDALWarpAppOptionsFree(GDALWarpAppOptions * psOptions) -> void

Frees the GDALWarpAppOptions struct.

Parameters

  • psOptions: the options struct for GDALWarp().
GDAL.gdalwarpappoptionsnewMethod
GDALWarpAppOptionsNew(char ** papszArgv,
                      GDALWarpAppOptionsForBinary * psOptionsForBinary) -> GDALWarpAppOptions *

Allocates a GDALWarpAppOptions struct.

Parameters

  • papszArgv: NULL terminated list of options (potentially including filename and open options too), or NULL. The accepted options are the ones of the gdalwarp utility.
  • psOptionsForBinary: (output) may be NULL (and should generally be NULL), otherwise (gdaltranslatebin.cpp use case) must be allocated with GDALWarpAppOptionsForBinaryNew() prior to this function. Will be filled with potentially present filename, open options,...

Returns

pointer to the allocated GDALWarpAppOptions struct. Must be freed with GDALWarpAppOptionsFree().

GDAL.gdalwarpappoptionssetprogressMethod
GDALWarpAppOptionsSetProgress(GDALWarpAppOptions * psOptions,
                              GDALProgressFunc pfnProgress,
                              void * pProgressData) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALWarp().
  • pfnProgress: the progress callback.
  • pProgressData: the user data for the progress callback.
GDAL.gdalwarpappoptionssetquietMethod
GDALWarpAppOptionsSetQuiet(GDALWarpAppOptions * psOptions,
                           int bQuiet) -> void

Set a progress function.

Parameters

  • psOptions: the options struct for GDALWarp().
  • bQuiet: whether GDALWarp() should emit messages on stdout.
GDAL.gdalwarpappoptionssetwarpoptionMethod
GDALWarpAppOptionsSetWarpOption(GDALWarpAppOptions * psOptions,
                                const char * pszKey,
                                const char * pszValue) -> void

Set a warp option.

Parameters

  • psOptions: the options struct for GDALWarp().
  • pszKey: key.
  • pszValue: value.
GDAL.gdalwarpcutlinemaskerMethod
GDALWarpCutlineMasker(void * pMaskFuncArg,
                      int nBandCount,
                      GDALDataType eType,
                      int nXOff,
                      int nYOff,
                      int nXSize,
                      int nYSize,
                      GByte ** ppImageData,
                      int bMaskIsFloat,
                      void * pValidityMask) -> CPLErr
GDAL.gdalwarpcutlinemaskerexMethod
GDALWarpCutlineMaskerEx(void * pMaskFuncArg,
                        int,
                        GDALDataType,
                        int nXOff,
                        int nYOff,
                        int nXSize,
                        int nYSize,
                        GByte **,
                        int bMaskIsFloat,
                        void * pValidityMask,
                        int * pnValidityFlag) -> CPLErr
GDAL.gdalwarpdstalphamaskerMethod
GDALWarpDstAlphaMasker(void * pMaskFuncArg,
                       int nBandCount,
                       GDALDataType,
                       int nXOff,
                       int nYOff,
                       int nXSize,
                       int nYSize,
                       GByte **,
                       int bMaskIsFloat,
                       void * pValidityMask) -> CPLErr
GDAL.gdalwarpinitdefaultbandmappingMethod
GDALWarpInitDefaultBandMapping(GDALWarpOptions * psOptionsIn,
                               int nBandCount) -> void

Init src and dst band mappings such that Bands[i] = i+1 for nBandCount Does nothing if psOptionsIn->nBandCount is non-zero.

Parameters

  • psOptionsIn: options to initialize.
  • nBandCount: bands to initialize for.
GDAL.gdalwarpinitdstnodataimagMethod
GDALWarpInitDstNoDataImag(GDALWarpOptions * psOptionsIn,
                          double dNoDataImag) -> void

Initialize padfDstNoDataImag with specified value.

Parameters

  • psOptionsIn: options to initialize.
  • dNoDataImag: value to initialize to.
GDAL.gdalwarpinitdstnodatarealMethod
GDALWarpInitDstNoDataReal(GDALWarpOptions * psOptionsIn,
                          double dNoDataReal) -> void

Initialize padfDstNoDataReal with specified value.

Parameters

  • psOptionsIn: options to initialize.
  • dNoDataReal: value to initialize to.
GDAL.gdalwarpinitnodatarealMethod
GDALWarpInitNoDataReal(GDALWarpOptions * psOptionsIn,
                       double dNoDataReal) -> void

Initialize padfSrcNoDataReal and padfDstNoDataReal with specified value.

Parameters

  • psOptionsIn: options to initialize.
  • dNoDataReal: value to initialize to.
GDAL.gdalwarpinitsrcnodataimagMethod
GDALWarpInitSrcNoDataImag(GDALWarpOptions * psOptionsIn,
                          double dNoDataImag) -> void

Initialize padfSrcNoDataImag with specified value.

Parameters

  • psOptionsIn: options to initialize.
  • dNoDataImag: value to initialize to.
GDAL.gdalwarpinitsrcnodatarealMethod
GDALWarpInitSrcNoDataReal(GDALWarpOptions * psOptionsIn,
                          double dNoDataReal) -> void

Initialize padfSrcNoDataReal with specified value.

Parameters

  • psOptionsIn: options to initialize.
  • dNoDataReal: value to initialize to.
GDAL.gdalwarpnodatamaskerMethod
GDALWarpNoDataMasker(void * pMaskFuncArg,
                     int nBandCount,
                     GDALDataType eType,
                     int,
                     int,
                     int nXSize,
                     int nYSize,
                     GByte ** ppImageData,
                     int bMaskIsFloat,
                     void * pValidityMask,
                     int * pbOutAllValid) -> CPLErr
GDAL.gdalwarpregionMethod
GDALWarpRegion(GDALWarpOperationH hOperation,
               int nDstXOff,
               int nDstYOff,
               int nDstXSize,
               int nDstYSize,
               int nSrcXOff,
               int nSrcYOff,
               int nSrcXSize,
               int nSrcYSize) -> CPLErr
GDAL.gdalwarpregiontobufferMethod
GDALWarpRegionToBuffer(GDALWarpOperationH hOperation,
                       int nDstXOff,
                       int nDstYOff,
                       int nDstXSize,
                       int nDstYSize,
                       void * pDataBuf,
                       GDALDataType eBufDataType,
                       int nSrcXOff,
                       int nSrcYOff,
                       int nSrcXSize,
                       int nSrcYSize) -> CPLErr
GDAL.gdalwarpresolveworkingdatatypeMethod
GDALWarpResolveWorkingDataType(GDALWarpOptions * psOptions) -> void

If the working data type is unknown, this method will determine a valid working data type to support the data in the src and dest data sets and any noData values.

Parameters

  • psOptions: options to initialize.
GDAL.gdalwarpsrcalphamaskerMethod
GDALWarpSrcAlphaMasker(void * pMaskFuncArg,
                       int,
                       GDALDataType,
                       int nXOff,
                       int nYOff,
                       int nXSize,
                       int nYSize,
                       GByte **,
                       int bMaskIsFloat,
                       void * pValidityMask,
                       int * pbOutAllOpaque) -> CPLErr
GDAL.gdalwarpsrcmaskmaskerMethod
GDALWarpSrcMaskMasker(void * pMaskFuncArg,
                      int,
                      GDALDataType,
                      int nXOff,
                      int nYOff,
                      int nXSize,
                      int nYSize,
                      GByte **,
                      int bMaskIsFloat,
                      void * pValidityMask) -> CPLErr
GDAL.gdalwriteblockMethod
GDALWriteBlock(GDALRasterBandH hBand,
               int nXOff,
               int nYOff,
               void * pData) -> CPLErr

Write a block of image data efficiently.

GDAL.gdalwriteworldfileMethod
GDALWriteWorldFile(const char * pszBaseFilename,
                   const char * pszExtension,
                   double * padfGeoTransform) -> int

Write ESRI world file.

Parameters

  • pszBaseFilename: the target raster file.
  • pszExtension: the extension to use (i.e. "wld"). Must not be NULL
  • padfGeoTransform: the six double array from which the geotransformation should be read.

Returns

TRUE on success or FALSE on failure.

GDAL.maybe_throwMethod

Check the last error type and throw a GDALError if it is a failure

GDAL.octcloneMethod
OCTClone(OGRCoordinateTransformationH hTransform) -> OGRCoordinateTransformationH

Clone transformation object.

Returns

handle to transformation's clone or NULL on error, must be freed with OCTDestroyCoordinateTransformation

GDAL.octcoordinatetransformationoptionssetareaofinterestMethod
OCTCoordinateTransformationOptionsSetAreaOfInterest(OGRCoordinateTransformationOptionsH hOptions,
                                                    double dfWestLongitudeDeg,
                                                    double dfSouthLatitudeDeg,
                                                    double dfEastLongitudeDeg,
                                                    double dfNorthLatitudeDeg) -> int

Sets an area of interest.

GDAL.octdestroycoordinatetransformationMethod
OCTDestroyCoordinateTransformation(OGRCoordinateTransformationH hCT) -> void

OGRCoordinateTransformation destructor.

Parameters

  • hCT: the object to delete
GDAL.octgetinverseMethod
OCTGetInverse(OGRCoordinateTransformationH hTransform) -> OGRCoordinateTransformationH

Inverse transformation object.

Returns

handle to inverse transformation or NULL on error, must be freed with OCTDestroyCoordinateTransformation

GDAL.octgetsourcecsMethod
OCTGetSourceCS(OGRCoordinateTransformationH hTransform) -> OGRSpatialReferenceH

Transformation's source coordinate system reference.

Returns

handle to transformation's source coordinate system or NULL if not present.

GDAL.octgettargetcsMethod
OCTGetTargetCS(OGRCoordinateTransformationH hTransform) -> OGRSpatialReferenceH

Transformation's target coordinate system reference.

Returns

handle to transformation's target coordinate system or NULL if not present.

GDAL.octnewcoordinatetransformationMethod
OCTNewCoordinateTransformation(OGRSpatialReferenceH hSourceSRS,
                               OGRSpatialReferenceH hTargetSRS) -> OGRCoordinateTransformationH

Create transformation object.

Parameters

  • hSourceSRS: source spatial reference system.
  • hTargetSRS: target spatial reference system.

Returns

NULL on failure or a ready to use transformation object.

GDAL.octnewcoordinatetransformationexMethod
OCTNewCoordinateTransformationEx(OGRSpatialReferenceH hSourceSRS,
                                 OGRSpatialReferenceH hTargetSRS,
                                 OGRCoordinateTransformationOptionsH hOptions) -> OGRCoordinateTransformationH

Create transformation object.

Parameters

  • hSourceSRS: source spatial reference system.
  • hTargetSRS: target spatial reference system.
  • hOptions: Coordinate transformation options.

Returns

NULL on failure or a ready to use transformation object.

GDAL.octtransformMethod
OCTTransform(OGRCoordinateTransformationH hTransform,
             int nCount,
             double * x,
             double * y,
             double * z) -> int

Transform an array of points.

Parameters

  • hTransform: Transformation object
  • nCount: Number of points
  • x: Array of nCount x values.
  • y: Array of nCount y values.
  • z: Array of nCount z values.

Returns

TRUE or FALSE

GDAL.octtransform4dMethod
OCTTransform4D(OGRCoordinateTransformationH hTransform,
               int nCount,
               double * x,
               double * y,
               double * z,
               double * t,
               int * pabSuccess) -> int

Transform an array of points.

Parameters

  • hTransform: Transformation object
  • nCount: Number of points
  • x: Array of nCount x values. Should not be NULL
  • y: Array of nCount y values. Should not be NULL
  • z: Array of nCount z values. Might be NULL
  • t: Array of nCount time values. Might be NULL
  • pabSuccess: Output array of nCount value that will be set to TRUE/FALSE. Might be NULL.

Returns

TRUE or FALSE

GDAL.octtransform4dwitherrorcodesMethod
OCTTransform4DWithErrorCodes(OGRCoordinateTransformationH hTransform,
                             int nCount,
                             double * x,
                             double * y,
                             double * z,
                             double * t,
                             int * panErrorCodes) -> int

Transform an array of points.

Parameters

  • hTransform: Transformation object
  • nCount: Number of points
  • x: Array of nCount x values. Should not be NULL
  • y: Array of nCount y values. Should not be NULL
  • z: Array of nCount z values. Might be NULL
  • t: Array of nCount time values. Might be NULL
  • panErrorCodes: Output array of nCount value that will be set to 0 for success, or a non-zero value for failure. Refer to PROJ 8 public error codes. Might be NULL

Returns

TRUE or FALSE

GDAL.octtransformboundsMethod
OCTTransformBounds(OGRCoordinateTransformationH hTransform,
                   const double xmin,
                   const double ymin,
                   const double xmax,
                   const double ymax,
                   double * out_xmin,
                   double * out_ymin,
                   double * out_xmax,
                   double * out_ymax,
                   int densify_pts) -> int

Transform boundary.

Parameters

  • hTransform: Transformation object
  • xmin: Minimum bounding coordinate of the first axis in source CRS.
  • ymin: Minimum bounding coordinate of the second axis in source CRS.
  • xmax: Maximum bounding coordinate of the first axis in source CRS.
  • ymax: Maximum bounding coordinate of the second axis in source CRS.
  • out_xmin: Minimum bounding coordinate of the first axis in target CRS
  • out_ymin: Minimum bounding coordinate of the second axis in target CRS.
  • out_xmax: Maximum bounding coordinate of the first axis in target CRS.
  • out_ymax: Maximum bounding coordinate of the second axis in target CRS.
  • densify_pts: Recommended to use 21. This is the number of points to use to densify the bounding polygon in the transformation.

Returns

TRUE if successful. FALSE if failures encountered.

GDAL.octtransformexMethod
OCTTransformEx(OGRCoordinateTransformationH hTransform,
               int nCount,
               double * x,
               double * y,
               double * z,
               int * pabSuccess) -> int

Transform an array of points.

Parameters

  • hTransform: Transformation object
  • nCount: Number of points
  • x: Array of nCount x values.
  • y: Array of nCount y values.
  • z: Array of nCount z values.
  • pabSuccess: Output array of nCount value that will be set to TRUE/FALSE

Returns

TRUE or FALSE

GDAL.ogr_aretypesubtypecompatibleMethod
OGR_AreTypeSubTypeCompatible(OGRFieldType eType,
                             OGRFieldSubType eSubType) -> int

Return if type and subtype are compatible.

Parameters

  • eType: the field type.
  • eSubType: the field subtype.

Returns

TRUE if type and subtype are compatible

GDAL.ogr_codedflddomain_createMethod
OGR_CodedFldDomain_Create(const char * pszName,
                          const char * pszDescription,
                          OGRFieldType eFieldType,
                          OGRFieldSubType eFieldSubType,
                          const OGRCodedValue * enumeration) -> OGRFieldDomainH

Creates a new coded field domain.

Parameters

  • pszName: Domain name. Should not be NULL.
  • pszDescription: Domain description (can be NULL)
  • eFieldType: Field type. Generally numeric. Potentially OFTDateTime
  • eFieldSubType: Field subtype.
  • enumeration: Enumeration as (code, value) pairs. Should not be NULL. The end of the enumeration is marked by a code set to NULL. The enumeration will be copied. Each code should appear only once, but it is the responsibility of the user to check it.

Returns

a new handle that should be freed with OGRFldDomainDestroy(), or NULL in case of error.

GDAL.ogr_codedflddomain_getenumerationMethod
OGR_CodedFldDomain_GetEnumeration(OGRFieldDomainH hFieldDomain) -> const OGRCodedValue *

Get the enumeration as (code, value) pairs.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the (code, value) pairs, or nullptr in case of error.

GDAL.ogr_dr_copydatasourceMethod
OGR_Dr_CopyDataSource(OGRSFDriverH,
                      OGRDataSourceH,
                      const char *,
                      char **) -> OGRDataSourceH

This function creates a new datasource by copying all the layers from the source datasource.

Parameters

  • hDriver: handle to the driver on which data source creation is based.
  • hSrcDS: source datasource
  • pszNewName: the name for the new data source.
  • papszOptions: a StringList of name=value options. Options are driver specific, and driver information can be found at the following url: http://www.gdal.org/ogr_formats.html

Returns

NULL is returned on failure, or a new OGRDataSource handle on success.

GDAL.ogr_dr_createdatasourceMethod
OGR_Dr_CreateDataSource(OGRSFDriverH,
                        const char *,
                        char **) -> OGRDataSourceH

This function attempts to create a new data source based on the passed driver.

Parameters

  • hDriver: handle to the driver on which data source creation is based.
  • pszName: the name for the new data source. UTF-8 encoded.
  • papszOptions: a StringList of name=value options. Options are driver specific, and driver information can be found at the following url: http://www.gdal.org/ogr_formats.html

Returns

NULL is returned on failure, or a new OGRDataSource handle on success.

GDAL.ogr_dr_deletedatasourceMethod
OGR_Dr_DeleteDataSource(OGRSFDriverH,
                        const char *) -> OGRErr

Delete a datasource.

Parameters

  • hDriver: handle to the driver on which data source deletion is based.
  • pszDataSource: the name of the datasource to delete.

Returns

OGRERRNONE on success, and OGRERRUNSUPPORTED_OPERATION if this is not supported by this driver.

GDAL.ogr_dr_getnameMethod
OGR_Dr_GetName(OGRSFDriverH) -> const char *

Fetch name of driver (file format).

Parameters

  • hDriver: handle to the driver to get the name from.

Returns

driver name. This is an internal string and should not be modified or freed.

GDAL.ogr_dr_openMethod
OGR_Dr_Open(OGRSFDriverH,
            const char *,
            int) -> OGRDataSourceH

Attempt to open file with this driver.

Parameters

  • hDriver: handle to the driver that is used to open file.
  • pszName: the name of the file, or data source to try and open.
  • bUpdate: TRUE if update access is required, otherwise FALSE (the default).

Returns

NULL on error or if the pass name is not supported by this driver, otherwise a handle to a GDALDataset. This GDALDataset should be closed by deleting the object when it is no longer needed.

GDAL.ogr_dr_testcapabilityMethod
OGR_Dr_TestCapability(OGRSFDriverH,
                      const char *) -> int

Test if capability is available.

Parameters

  • hDriver: handle to the driver to test the capability against.
  • pszCap: the capability to test.

Returns

TRUE if capability available otherwise FALSE.

GDAL.ogr_ds_copylayerMethod
OGR_DS_CopyLayer(OGRDataSourceH hDS,
                 OGRLayerH hSrcLayer,
                 const char * pszNewName,
                 char ** papszOptions) -> OGRLayerH

Duplicate an existing layer.

Parameters

  • hDS: handle to the data source where to create the new layer
  • hSrcLayer: handle to the source layer.
  • pszNewName: the name of the layer to create.
  • papszOptions: a StringList of name=value options. Options are driver specific.

Returns

a handle to the layer, or NULL if an error occurs.

GDAL.ogr_ds_createlayerMethod
OGR_DS_CreateLayer(OGRDataSourceH hDS,
                   const char * pszName,
                   OGRSpatialReferenceH hSpatialRef,
                   OGRwkbGeometryType eType,
                   char ** papszOptions) -> OGRLayerH

This function attempts to create a new layer on the data source with the indicated name, coordinate system, geometry type.

Parameters

  • hDS: The dataset handle.
  • pszName: the name for the new layer. This should ideally not match any existing layer on the datasource.
  • hSpatialRef: handle to the coordinate system to use for the new layer, or NULL if no coordinate system is available. The driver might only increase the reference counter of the object to take ownership, and not make a full copy, so do not use OSRDestroySpatialReference(), but OSRRelease() instead when you are done with the object.
  • eType: the geometry type for the layer. Use wkbUnknown if there are no constraints on the types geometry to be written.
  • papszOptions: a StringList of name=value options. Options are driver specific, and driver information can be found at the following url: http://www.gdal.org/ogr_formats.html

Returns

NULL is returned on failure, or a new OGRLayer handle on success.

GDAL.ogr_ds_deletelayerMethod
OGR_DS_DeleteLayer(OGRDataSourceH hDS,
                   int iLayer) -> OGRErr

Delete the indicated layer from the datasource.

Parameters

  • hDS: handle to the datasource
  • iLayer: the index of the layer to delete.

Returns

OGRERRNONE on success, or OGRERRUNSUPPORTED_OPERATION if deleting layers is not supported for this datasource.

GDAL.ogr_ds_destroyMethod
OGR_DS_Destroy(OGRDataSourceH hDS) -> void

Closes opened datasource and releases allocated resources.

Parameters

  • hDS: handle to allocated datasource object.
GDAL.ogr_ds_executesqlMethod
OGR_DS_ExecuteSQL(OGRDataSourceH hDS,
                  const char * pszStatement,
                  OGRGeometryH hSpatialFilter,
                  const char * pszDialect) -> OGRLayerH

Execute an SQL statement against the data store.

Parameters

  • hDS: handle to the data source on which the SQL query is executed.
  • pszStatement: the SQL statement to execute.
  • hSpatialFilter: handle to a geometry which represents a spatial filter. Can be NULL.
  • pszDialect: allows control of the statement dialect. If set to NULL, the OGR SQL engine will be used, except for RDBMS drivers that will use their dedicated SQL engine, unless OGRSQL is explicitly passed as the dialect. The SQLITE dialect can also be used.

Returns

a handle to a OGRLayer containing the results of the query. Deallocate with OGRDSReleaseResultSet().

GDAL.ogr_ds_getdriverMethod
OGR_DS_GetDriver(OGRDataSourceH hDS) -> OGRSFDriverH

Returns the driver that the dataset was opened with.

Parameters

  • hDS: handle to the datasource

Returns

NULL if driver info is not available, or pointer to a driver owned by the OGRSFDriverManager.

GDAL.ogr_ds_getlayerMethod
OGR_DS_GetLayer(OGRDataSourceH hDS,
                int iLayer) -> OGRLayerH

Fetch a layer by index.

Parameters

  • hDS: handle to the data source from which to get the layer.
  • iLayer: a layer number between 0 and OGRDSGetLayerCount()-1.

Returns

a handle to the layer, or NULL if iLayer is out of range or an error occurs.

GDAL.ogr_ds_getlayerbynameMethod
OGR_DS_GetLayerByName(OGRDataSourceH hDS,
                      const char * pszLayerName) -> OGRLayerH

Fetch a layer by name.

Parameters

  • hDS: handle to the data source from which to get the layer.
  • pszLayerName: Layer the layer name of the layer to fetch.

Returns

a handle to the layer, or NULL if the layer is not found or an error occurs.

GDAL.ogr_ds_getlayercountMethod
OGR_DS_GetLayerCount(OGRDataSourceH hDS) -> int

Get the number of layers in this data source.

Parameters

  • hDS: handle to the data source from which to get the number of layers.

Returns

layer count.

GDAL.ogr_ds_getnameMethod
OGR_DS_GetName(OGRDataSourceH hDS) -> const char *

Returns the name of the data source.

Parameters

  • hDS: handle to the data source to get the name from.

Returns

pointer to an internal name string which should not be modified or freed by the caller.

GDAL.ogr_ds_releaseresultsetMethod
OGR_DS_ReleaseResultSet(OGRDataSourceH hDS,
                        OGRLayerH hLayer) -> void

Release results of OGRDSExecuteSQL().

Parameters

  • hDS: a handle to the data source on which was executed an SQL query.
  • hLayer: handle to the result of a previous OGRDSExecuteSQL() call.
GDAL.ogr_ds_synctodiskMethod
ogr_ds_synctodisk(arg1)

Flush pending changes to disk. See GDALDataset::FlushCache()

GDAL.ogr_ds_testcapabilityMethod
OGR_DS_TestCapability(OGRDataSourceH hDS,
                      const char * pszCapability) -> int

Test if capability is available.

Parameters

  • hDS: handle to the data source against which to test the capability.
  • pszCapability: the capability to test.

Returns

TRUE if capability available otherwise FALSE.

GDAL.ogr_f_cloneMethod
OGR_F_Clone(OGRFeatureH hFeat) -> OGRFeatureH

Duplicate feature.

Parameters

  • hFeat: handle to the feature to clone.

Returns

a handle to the new feature, exactly matching this feature.

GDAL.ogr_f_createMethod
OGR_F_Create(OGRFeatureDefnH hDefn) -> OGRFeatureH

Feature factory.

Parameters

  • hDefn: handle to the feature class (layer) definition to which the feature will adhere.

Returns

a handle to the new feature object with null fields and no geometry, or, starting with GDAL 2.1, NULL in case out of memory situation.

GDAL.ogr_f_destroyMethod
OGR_F_Destroy(OGRFeatureH hFeat) -> void

Destroy feature.

Parameters

  • hFeat: handle to the feature to destroy.
GDAL.ogr_f_dumpreadableMethod
OGR_F_DumpReadable(OGRFeatureH hFeat,
                   FILE * fpOut) -> void

Dump this feature in a human readable form.

Parameters

  • hFeat: handle to the feature to dump.
  • fpOut: the stream to write to, such as strout.
GDAL.ogr_f_equalMethod
OGR_F_Equal(OGRFeatureH hFeat,
            OGRFeatureH hOtherFeat) -> int

Test if two features are the same.

Parameters

  • hFeat: handle to one of the feature.
  • hOtherFeat: handle to the other feature to test this one against.

Returns

TRUE if they are equal, otherwise FALSE.

GDAL.ogr_f_fillunsetwithdefaultMethod
OGR_F_FillUnsetWithDefault(OGRFeatureH hFeat,
                           int bNotNullableOnly,
                           char ** papszOptions) -> void

Fill unset fields with default values that might be defined.

Parameters

  • hFeat: handle to the feature.
  • bNotNullableOnly: if we should fill only unset fields with a not-null constraint.
  • papszOptions: unused currently. Must be set to NULL.
GDAL.ogr_f_getdefnrefMethod
OGR_F_GetDefnRef(OGRFeatureH hFeat) -> OGRFeatureDefnH

Fetch feature definition.

Parameters

  • hFeat: handle to the feature to get the feature definition from.

Returns

a handle to the feature definition object on which feature depends.

GDAL.ogr_f_getfidMethod
OGR_F_GetFID(OGRFeatureH hFeat) -> GIntBig

Get feature identifier.

Parameters

  • hFeat: handle to the feature from which to get the feature identifier.

Returns

feature id or OGRNullFID if none has been assigned.

GDAL.ogr_f_getfieldasbinaryMethod
OGR_F_GetFieldAsBinary(OGRFeatureH hFeat,
                       int iField,
                       int * pnBytes) -> GByte *

Fetch field value as binary.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pnBytes: location to place count of bytes returned.

Returns

the field value. This list is internal, and should not be modified, or freed. Its lifetime may be very brief.

GDAL.ogr_f_getfieldasdatetimeMethod
OGR_F_GetFieldAsDateTime(OGRFeatureH hFeat,
                         int iField,
                         int * pnYear,
                         int * pnMonth,
                         int * pnDay,
                         int * pnHour,
                         int * pnMinute,
                         int * pnSecond,
                         int * pnTZFlag) -> int

Fetch field value as date and time.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pnYear: (including century)
  • pnMonth: (1-12)
  • pnDay: (1-31)
  • pnHour: (0-23)
  • pnMinute: (0-59)
  • pnSecond: (0-59)
  • pnTZFlag: (0=unknown, 1=localtime, 100=GMT, see data model for details)

Returns

TRUE on success or FALSE on failure.

GDAL.ogr_f_getfieldasdatetimeexMethod
OGR_F_GetFieldAsDateTimeEx(OGRFeatureH hFeat,
                           int iField,
                           int * pnYear,
                           int * pnMonth,
                           int * pnDay,
                           int * pnHour,
                           int * pnMinute,
                           float * pfSecond,
                           int * pnTZFlag) -> int

Fetch field value as date and time.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pnYear: (including century)
  • pnMonth: (1-12)
  • pnDay: (1-31)
  • pnHour: (0-23)
  • pnMinute: (0-59)
  • pfSecond: (0-59 with millisecond accuracy)
  • pnTZFlag: (0=unknown, 1=localtime, 100=GMT, see data model for details)

Returns

TRUE on success or FALSE on failure.

GDAL.ogr_f_getfieldasdoubleMethod
OGR_F_GetFieldAsDouble(OGRFeatureH hFeat,
                       int iField) -> double

Fetch field value as a double.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.

Returns

the field value.

GDAL.ogr_f_getfieldasdoublelistMethod
OGR_F_GetFieldAsDoubleList(OGRFeatureH hFeat,
                           int iField,
                           int * pnCount) -> const double *

Fetch field value as a list of doubles.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pnCount: an integer to put the list count (number of doubles) into.

Returns

the field value. This list is internal, and should not be modified, or freed. Its lifetime may be very brief. If *pnCount is zero on return the returned pointer may be NULL or non-NULL.

GDAL.ogr_f_getfieldasintegerMethod
OGR_F_GetFieldAsInteger(OGRFeatureH hFeat,
                        int iField) -> int

Fetch field value as integer.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.

Returns

the field value.

GDAL.ogr_f_getfieldasinteger64Method
OGR_F_GetFieldAsInteger64(OGRFeatureH hFeat,
                          int iField) -> GIntBig

Fetch field value as integer 64 bit.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.

Returns

the field value.

GDAL.ogr_f_getfieldasinteger64listMethod
OGR_F_GetFieldAsInteger64List(OGRFeatureH hFeat,
                              int iField,
                              int * pnCount) -> const GIntBig *

Fetch field value as a list of 64 bit integers.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pnCount: an integer to put the list count (number of integers) into.

Returns

the field value. This list is internal, and should not be modified, or freed. Its lifetime may be very brief. If *pnCount is zero on return the returned pointer may be NULL or non-NULL.

GDAL.ogr_f_getfieldasintegerlistMethod
OGR_F_GetFieldAsIntegerList(OGRFeatureH hFeat,
                            int iField,
                            int * pnCount) -> const int *

Fetch field value as a list of integers.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pnCount: an integer to put the list count (number of integers) into.

Returns

the field value. This list is internal, and should not be modified, or freed. Its lifetime may be very brief. If *pnCount is zero on return the returned pointer may be NULL or non-NULL.

GDAL.ogr_f_getfieldasiso8601datetimeMethod
OGR_F_GetFieldAsISO8601DateTime(OGRFeatureH hFeat,
                                int iField,
                                CSLConstList papszOptions) -> const char *

Fetch OFTDateTime field value as a ISO8601 representation.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • papszOptions: NULL terminated list of strings, or NULL. No options are defined currently.

Returns

the field value. This string is internal, and should not be modified, or freed. Its lifetime may be very brief.

GDAL.ogr_f_getfieldasstringMethod
OGR_F_GetFieldAsString(OGRFeatureH hFeat,
                       int iField) -> const char *

Fetch field value as a string.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.

Returns

the field value. This string is internal, and should not be modified, or freed. Its lifetime may be very brief.

GDAL.ogr_f_getfieldasstringlistMethod
OGR_F_GetFieldAsStringList(OGRFeatureH hFeat,
                           int iField) -> char **

Fetch field value as a list of strings.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.

Returns

the field value. This list is internal, and should not be modified, or freed. Its lifetime may be very brief.

GDAL.ogr_f_getfieldcountMethod
OGR_F_GetFieldCount(OGRFeatureH hFeat) -> int

Fetch number of fields on this feature This will always be the same as the field count for the OGRFeatureDefn.

Parameters

  • hFeat: handle to the feature to get the fields count from.

Returns

count of fields.

GDAL.ogr_f_getfielddefnrefMethod
OGR_F_GetFieldDefnRef(OGRFeatureH hFeat,
                      int i) -> OGRFieldDefnH

Fetch definition for this field.

Parameters

  • hFeat: handle to the feature on which the field is found.
  • i: the field to fetch, from 0 to GetFieldCount()-1.

Returns

a handle to the field definition (from the OGRFeatureDefn). This is an internal reference, and should not be deleted or modified.

GDAL.ogr_f_getfieldindexMethod
OGR_F_GetFieldIndex(OGRFeatureH hFeat,
                    const char * pszName) -> int

Fetch the field index given field name.

Parameters

  • hFeat: handle to the feature on which the field is found.
  • pszName: the name of the field to search for.

Returns

the field index, or -1 if no matching field is found.

GDAL.ogr_f_getgeometryrefMethod
OGR_F_GetGeometryRef(OGRFeatureH hFeat) -> OGRGeometryH

Fetch a handle to feature geometry.

Parameters

  • hFeat: handle to the feature to get geometry from.

Returns

a handle to internal feature geometry. This object should not be modified.

GDAL.ogr_f_getgeomfieldcountMethod
OGR_F_GetGeomFieldCount(OGRFeatureH hFeat) -> int

Fetch number of geometry fields on this feature This will always be the same as the geometry field count for the OGRFeatureDefn.

Parameters

  • hFeat: handle to the feature to get the geometry fields count from.

Returns

count of geometry fields.

GDAL.ogr_f_getgeomfielddefnrefMethod
OGR_F_GetGeomFieldDefnRef(OGRFeatureH hFeat,
                          int i) -> OGRGeomFieldDefnH

Fetch definition for this geometry field.

Parameters

  • hFeat: handle to the feature on which the field is found.
  • i: the field to fetch, from 0 to GetGeomFieldCount()-1.

Returns

a handle to the field definition (from the OGRFeatureDefn). This is an internal reference, and should not be deleted or modified.

GDAL.ogr_f_getgeomfieldindexMethod
OGR_F_GetGeomFieldIndex(OGRFeatureH hFeat,
                        const char * pszName) -> int

Fetch the geometry field index given geometry field name.

Parameters

  • hFeat: handle to the feature on which the geometry field is found.
  • pszName: the name of the geometry field to search for.

Returns

the geometry field index, or -1 if no matching geometry field is found.

GDAL.ogr_f_getgeomfieldrefMethod
OGR_F_GetGeomFieldRef(OGRFeatureH hFeat,
                      int iField) -> OGRGeometryH

Fetch a handle to feature geometry.

Parameters

  • hFeat: handle to the feature to get geometry from.
  • iField: geometry field to get.

Returns

a handle to internal feature geometry. This object should not be modified.

GDAL.ogr_f_getnativedataMethod
OGR_F_GetNativeData(OGRFeatureH hFeat) -> const char *

Returns the native data for the feature.

Parameters

  • hFeat: handle to the feature.

Returns

a string with the native data, or NULL if there is none.

GDAL.ogr_f_getnativemediatypeMethod
OGR_F_GetNativeMediaType(OGRFeatureH hFeat) -> const char *

Returns the native media type for the feature.

Parameters

  • hFeat: handle to the feature.

Returns

a string with the native media type, or NULL if there is none.

GDAL.ogr_f_getrawfieldrefMethod
OGR_F_GetRawFieldRef(OGRFeatureH hFeat,
                     int iField) -> OGRField *

Fetch a handle to the internal field value given the index.

Parameters

  • hFeat: handle to the feature on which field is found.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.

Returns

the returned handle is to an internal data structure, and should not be freed, or modified.

GDAL.ogr_f_getstylestringMethod
OGR_F_GetStyleString(OGRFeatureH hFeat) -> const char *

Fetch style string for this feature.

Parameters

  • hFeat: handle to the feature to get the style from.

Returns

a reference to a representation in string format, or NULL if there isn't one.

GDAL.ogr_f_isfieldnullMethod
OGR_F_IsFieldNull(OGRFeatureH hFeat,
                  int iField) -> int

Test if a field is null.

Parameters

  • hFeat: handle to the feature on which the field is.
  • iField: the field to test.

Returns

TRUE if the field is null, otherwise false.

GDAL.ogr_f_isfieldsetMethod
OGR_F_IsFieldSet(OGRFeatureH hFeat,
                 int iField) -> int

Test if a field has ever been assigned a value or not.

Parameters

  • hFeat: handle to the feature on which the field is.
  • iField: the field to test.

Returns

TRUE if the field has been set, otherwise false.

GDAL.ogr_f_isfieldsetandnotnullMethod
OGR_F_IsFieldSetAndNotNull(OGRFeatureH hFeat,
                           int iField) -> int

Test if a field is set and not null.

Parameters

  • hFeat: handle to the feature on which the field is.
  • iField: the field to test.

Returns

TRUE if the field is set and not null, otherwise false.

GDAL.ogr_f_setfidMethod
OGR_F_SetFID(OGRFeatureH hFeat,
             GIntBig nFID) -> OGRErr

Set the feature identifier.

Parameters

  • hFeat: handle to the feature to set the feature id to.
  • nFID: the new feature identifier value to assign.

Returns

On success OGRERR_NONE, or on failure some other value.

GDAL.ogr_f_setfieldbinaryMethod
OGR_F_SetFieldBinary(OGRFeatureH hFeat,
                     int iField,
                     int nBytes,
                     const void * pabyData) -> void

Set field to binary data.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • nBytes: the number of bytes in pabyData array.
  • pabyData: the data to apply.
GDAL.ogr_f_setfielddatetimeMethod
OGR_F_SetFieldDateTime(OGRFeatureH hFeat,
                       int iField,
                       int nYear,
                       int nMonth,
                       int nDay,
                       int nHour,
                       int nMinute,
                       int nSecond,
                       int nTZFlag) -> void

Set field to datetime.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • nYear: (including century)
  • nMonth: (1-12)
  • nDay: (1-31)
  • nHour: (0-23)
  • nMinute: (0-59)
  • nSecond: (0-59)
  • nTZFlag: (0=unknown, 1=localtime, 100=GMT, see data model for details)
GDAL.ogr_f_setfielddatetimeexMethod
OGR_F_SetFieldDateTimeEx(OGRFeatureH hFeat,
                         int iField,
                         int nYear,
                         int nMonth,
                         int nDay,
                         int nHour,
                         int nMinute,
                         float fSecond,
                         int nTZFlag) -> void

Set field to datetime.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • nYear: (including century)
  • nMonth: (1-12)
  • nDay: (1-31)
  • nHour: (0-23)
  • nMinute: (0-59)
  • fSecond: (0-59, with millisecond accuracy)
  • nTZFlag: (0=unknown, 1=localtime, 100=GMT, see data model for details)
GDAL.ogr_f_setfielddoubleMethod
OGR_F_SetFieldDouble(OGRFeatureH hFeat,
                     int iField,
                     double dfValue) -> void

Set field to double value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • dfValue: the value to assign.
GDAL.ogr_f_setfielddoublelistMethod
OGR_F_SetFieldDoubleList(OGRFeatureH hFeat,
                         int iField,
                         int nCount,
                         const double * padfValues) -> void

Set field to list of doubles value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • nCount: the number of values in the list being assigned.
  • padfValues: the values to assign.
GDAL.ogr_f_setfieldintegerMethod
OGR_F_SetFieldInteger(OGRFeatureH hFeat,
                      int iField,
                      int nValue) -> void

Set field to integer value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • nValue: the value to assign.
GDAL.ogr_f_setfieldinteger64Method
OGR_F_SetFieldInteger64(OGRFeatureH hFeat,
                        int iField,
                        GIntBig nValue) -> void

Set field to 64 bit integer value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • nValue: the value to assign.
GDAL.ogr_f_setfieldinteger64listMethod
OGR_F_SetFieldInteger64List(OGRFeatureH hFeat,
                            int iField,
                            int nCount,
                            const GIntBig * panValues) -> void

Set field to list of 64 bit integers value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • nCount: the number of values in the list being assigned.
  • panValues: the values to assign.
GDAL.ogr_f_setfieldintegerlistMethod
OGR_F_SetFieldIntegerList(OGRFeatureH hFeat,
                          int iField,
                          int nCount,
                          const int * panValues) -> void

Set field to list of integers value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • nCount: the number of values in the list being assigned.
  • panValues: the values to assign.
GDAL.ogr_f_setfieldnullMethod
OGR_F_SetFieldNull(OGRFeatureH hFeat,
                   int iField) -> void

Clear a field, marking it as null.

Parameters

  • hFeat: handle to the feature on which the field is.
  • iField: the field to set to null.
GDAL.ogr_f_setfieldrawMethod
OGR_F_SetFieldRaw(OGRFeatureH hFeat,
                  int iField,
                  const OGRField * psValue) -> void

Set field.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • psValue: handle on the value to assign.
GDAL.ogr_f_setfieldstringMethod
OGR_F_SetFieldString(OGRFeatureH hFeat,
                     int iField,
                     const char * pszValue) -> void

Set field to string value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to fetch, from 0 to GetFieldCount()-1.
  • pszValue: the value to assign.
GDAL.ogr_f_setfieldstringlistMethod
OGR_F_SetFieldStringList(OGRFeatureH hFeat,
                         int iField,
                         CSLConstList papszValues) -> void

Set field to list of strings value.

Parameters

  • hFeat: handle to the feature that owned the field.
  • iField: the field to set, from 0 to GetFieldCount()-1.
  • papszValues: the values to assign. List of NUL-terminated string, ending with a NULL pointer.
GDAL.ogr_f_setfromMethod
OGR_F_SetFrom(OGRFeatureH hFeat,
              OGRFeatureH hOtherFeat,
              int bForgiving) -> OGRErr

Set one feature from another.

Parameters

  • hFeat: handle to the feature to set to.
  • hOtherFeat: handle to the feature from which geometry, and field values will be copied.
  • bForgiving: TRUE if the operation should continue despite lacking output fields matching some of the source fields.

Returns

OGRERR_NONE if the operation succeeds, even if some values are not transferred, otherwise an error code.

GDAL.ogr_f_setfromwithmapMethod
OGR_F_SetFromWithMap(OGRFeatureH hFeat,
                     OGRFeatureH hOtherFeat,
                     int bForgiving,
                     const int * panMap) -> OGRErr

Set one feature from another.

Parameters

  • hFeat: handle to the feature to set to.
  • hOtherFeat: handle to the feature from which geometry, and field values will be copied.
  • panMap: Array of the indices of the destination feature's fields stored at the corresponding index of the source feature's fields. A value of -1 should be used to ignore the source's field. The array should not be NULL and be as long as the number of fields in the source feature.
  • bForgiving: TRUE if the operation should continue despite lacking output fields matching some of the source fields.

Returns

OGRERR_NONE if the operation succeeds, even if some values are not transferred, otherwise an error code.

GDAL.ogr_f_setgeometryMethod
OGR_F_SetGeometry(OGRFeatureH hFeat,
                  OGRGeometryH hGeom) -> OGRErr

Set feature geometry.

Parameters

  • hFeat: handle to the feature on which new geometry is applied to.
  • hGeom: handle to the new geometry to apply to feature.

Returns

OGRERRNONE if successful, or OGRUNSUPPORTEDGEOMETRYTYPE if the geometry type is illegal for the OGRFeatureDefn (checking not yet implemented).

GDAL.ogr_f_setgeometrydirectlyMethod
OGR_F_SetGeometryDirectly(OGRFeatureH hFeat,
                          OGRGeometryH hGeom) -> OGRErr

Set feature geometry.

Parameters

  • hFeat: handle to the feature on which to apply the geometry.
  • hGeom: handle to the new geometry to apply to feature.

Returns

OGRERRNONE if successful, or OGRUNSUPPORTEDGEOMETRYTYPE if the geometry type is illegal for the OGRFeatureDefn (checking not yet implemented).

GDAL.ogr_f_setgeomfieldMethod
OGR_F_SetGeomField(OGRFeatureH hFeat,
                   int iField,
                   OGRGeometryH hGeom) -> OGRErr

Set feature geometry of a specified geometry field.

Parameters

  • hFeat: handle to the feature on which new geometry is applied to.
  • iField: geometry field to set.
  • hGeom: handle to the new geometry to apply to feature.

Returns

OGRERRNONE if successful, or OGRUNSUPPORTEDGEOMETRYTYPE if the geometry type is illegal for the OGRFeatureDefn (checking not yet implemented).

GDAL.ogr_f_setgeomfielddirectlyMethod
OGR_F_SetGeomFieldDirectly(OGRFeatureH hFeat,
                           int iField,
                           OGRGeometryH hGeom) -> OGRErr

Set feature geometry of a specified geometry field.

Parameters

  • hFeat: handle to the feature on which to apply the geometry.
  • iField: geometry field to set.
  • hGeom: handle to the new geometry to apply to feature.

Returns

OGRERRNONE if successful, or OGRERRFAILURE if the index is invalid, or OGRUNSUPPORTEDGEOMETRY_TYPE if the geometry type is illegal for the OGRFeatureDefn (checking not yet implemented).

GDAL.ogr_f_setnativedataMethod
OGR_F_SetNativeData(OGRFeatureH hFeat,
                    const char * pszNativeData) -> void

Sets the native data for the feature.

Parameters

  • hFeat: handle to the feature.
  • pszNativeData: a string with the native data, or NULL if there is none.
GDAL.ogr_f_setnativemediatypeMethod
OGR_F_SetNativeMediaType(OGRFeatureH hFeat,
                         const char * pszNativeMediaType) -> void

Sets the native media type for the feature.

Parameters

  • hFeat: handle to the feature.
  • pszNativeMediaType: a string with the native media type, or NULL if there is none.
GDAL.ogr_f_setstylestringMethod
OGR_F_SetStyleString(OGRFeatureH hFeat,
                     const char * pszStyle) -> void

Set feature style string.

Parameters

  • hFeat: handle to the feature to set style to.
  • pszStyle: the style string to apply to this feature, cannot be NULL.
GDAL.ogr_f_setstylestringdirectlyMethod
OGR_F_SetStyleStringDirectly(OGRFeatureH hFeat,
                             char * pszStyle) -> void

Set feature style string.

Parameters

  • hFeat: handle to the feature to set style to.
  • pszStyle: the style string to apply to this feature, cannot be NULL.
GDAL.ogr_f_stealgeometryMethod
OGR_F_StealGeometry(OGRFeatureH hFeat) -> OGRGeometryH

Take away ownership of geometry.

Parameters

  • hFeat: feature from which to steal the first geometry.

Returns

the pointer to the stolen geometry.

GDAL.ogr_f_stealgeometryexMethod
OGR_F_StealGeometryEx(OGRFeatureH hFeat,
                      int iGeomField) -> OGRGeometryH

Take away ownership of geometry.

Parameters

  • hFeat: feature from which to steal a geometry.
  • iGeomField: index of the geometry field to steal.

Returns

the pointer to the stolen geometry.

GDAL.ogr_f_unsetfieldMethod
OGR_F_UnsetField(OGRFeatureH hFeat,
                 int iField) -> void

Clear a field, marking it as unset.

Parameters

  • hFeat: handle to the feature on which the field is.
  • iField: the field to unset.
GDAL.ogr_f_validateMethod
OGR_F_Validate(OGRFeatureH hFeat,
               int nValidateFlags,
               int bEmitError) -> int

Validate that a feature meets constraints of its schema.

Parameters

  • hFeat: handle to the feature to validate.
  • nValidateFlags: OGRFVALALL or combination of OGRFVALNULL, OGRFVALGEOMTYPE, OGRFVALWIDTH and OGRFVALALLOWNULLWHEN_DEFAULT with '|' operator
  • bEmitError: TRUE if a CPLError() must be emitted when a check fails

Returns

TRUE if all enabled validation tests pass.

GDAL.ogr_fd_addfielddefnMethod
OGR_FD_AddFieldDefn(OGRFeatureDefnH hDefn,
                    OGRFieldDefnH hNewField) -> void

Add a new field definition to the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to add the field definition to.
  • hNewField: handle to the new field definition.
GDAL.ogr_fd_addgeomfielddefnMethod
OGR_FD_AddGeomFieldDefn(OGRFeatureDefnH hDefn,
                        OGRGeomFieldDefnH hNewGeomField) -> void

Add a new field definition to the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to add the geometry field definition to.
  • hNewGeomField: handle to the new field definition.
GDAL.ogr_fd_createMethod
OGR_FD_Create(const char * pszName) -> OGRFeatureDefnH

Create a new feature definition object to hold the field definitions.

Parameters

  • pszName: the name to be assigned to this layer/class. It does not need to be unique.

Returns

handle to the newly created feature definition.

GDAL.ogr_fd_deletefielddefnMethod
OGR_FD_DeleteFieldDefn(OGRFeatureDefnH hDefn,
                       int iField) -> OGRErr

Delete an existing field definition.

Parameters

  • hDefn: handle to the feature definition.
  • iField: the index of the field definition.

Returns

OGRERR_NONE in case of success.

GDAL.ogr_fd_deletegeomfielddefnMethod
OGR_FD_DeleteGeomFieldDefn(OGRFeatureDefnH hDefn,
                           int iGeomField) -> OGRErr

Delete an existing geometry field definition.

Parameters

  • hDefn: handle to the feature definition.
  • iGeomField: the index of the geometry field definition.

Returns

OGRERR_NONE in case of success.

GDAL.ogr_fd_dereferenceMethod
OGR_FD_Dereference(OGRFeatureDefnH hDefn) -> int

Decrements the reference count by one.

Parameters

  • hDefn: handle to the feature definition on witch OGRFeature are based on.

Returns

the updated reference count.

GDAL.ogr_fd_destroyMethod
OGR_FD_Destroy(OGRFeatureDefnH hDefn) -> void

Destroy a feature definition object and release all memory associated with it.

Parameters

  • hDefn: handle to the feature definition to be destroyed.
GDAL.ogr_fd_getfieldcountMethod
OGR_FD_GetFieldCount(OGRFeatureDefnH hDefn) -> int

Fetch number of fields on the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to get the fields count from.

Returns

count of fields.

GDAL.ogr_fd_getfielddefnMethod
OGR_FD_GetFieldDefn(OGRFeatureDefnH hDefn,
                    int iField) -> OGRFieldDefnH

Fetch field definition of the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to get the field definition from.
  • iField: the field to fetch, between 0 and GetFieldCount()-1.

Returns

a handle to an internal field definition object or NULL if invalid index. This object should not be modified or freed by the application.

GDAL.ogr_fd_getfieldindexMethod
OGR_FD_GetFieldIndex(OGRFeatureDefnH hDefn,
                     const char * pszFieldName) -> int

Find field by name.

Parameters

  • hDefn: handle to the feature definition to get field index from.
  • pszFieldName: the field name to search for.

Returns

the field index, or -1 if no match found.

GDAL.ogr_fd_getgeomfieldcountMethod
OGR_FD_GetGeomFieldCount(OGRFeatureDefnH hDefn) -> int

Fetch number of geometry fields on the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to get the fields count from.

Returns

count of geometry fields.

GDAL.ogr_fd_getgeomfielddefnMethod
OGR_FD_GetGeomFieldDefn(OGRFeatureDefnH hDefn,
                        int iGeomField) -> OGRGeomFieldDefnH

Fetch geometry field definition of the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to get the field definition from.
  • iGeomField: the geometry field to fetch, between 0 and GetGeomFieldCount() - 1.

Returns

a handle to an internal field definition object or NULL if invalid index. This object should not be modified or freed by the application.

GDAL.ogr_fd_getgeomfieldindexMethod
OGR_FD_GetGeomFieldIndex(OGRFeatureDefnH hDefn,
                         const char * pszGeomFieldName) -> int

Find geometry field by name.

Parameters

  • hDefn: handle to the feature definition to get field index from.
  • pszGeomFieldName: the geometry field name to search for.

Returns

the geometry field index, or -1 if no match found.

GDAL.ogr_fd_getgeomtypeMethod
OGR_FD_GetGeomType(OGRFeatureDefnH hDefn) -> OGRwkbGeometryType

Fetch the geometry base type of the passed feature definition.

Parameters

  • hDefn: handle to the feature definition to get the geometry type from.

Returns

the base type for all geometry related to this definition.

GDAL.ogr_fd_getnameMethod
OGR_FD_GetName(OGRFeatureDefnH hDefn) -> const char *

Get name of the OGRFeatureDefn passed as an argument.

Parameters

  • hDefn: handle to the feature definition to get the name from.

Returns

the name. This name is internal and should not be modified, or freed.

GDAL.ogr_fd_getreferencecountMethod
OGR_FD_GetReferenceCount(OGRFeatureDefnH hDefn) -> int

Fetch current reference count.

Parameters

  • hDefn: handle to the feature definition on witch OGRFeature are based on.

Returns

the current reference count.

GDAL.ogr_fd_isgeometryignoredMethod
OGR_FD_IsGeometryIgnored(OGRFeatureDefnH hDefn) -> int

Determine whether the geometry can be omitted when fetching features.

Parameters

  • hDefn: handle to the feature definition on witch OGRFeature are based on.

Returns

ignore state

GDAL.ogr_fd_issameMethod
OGR_FD_IsSame(OGRFeatureDefnH hFDefn,
              OGRFeatureDefnH hOtherFDefn) -> int

Test if the feature definition is identical to the other one.

Parameters

  • hFDefn: handle to the feature definition on witch OGRFeature are based on.
  • hOtherFDefn: handle to the other feature definition to compare to.

Returns

TRUE if the feature definition is identical to the other one.

GDAL.ogr_fd_isstyleignoredMethod
OGR_FD_IsStyleIgnored(OGRFeatureDefnH hDefn) -> int

Determine whether the style can be omitted when fetching features.

Parameters

  • hDefn: handle to the feature definition on which OGRFeature are based on.

Returns

ignore state

GDAL.ogr_fd_referenceMethod
OGR_FD_Reference(OGRFeatureDefnH hDefn) -> int

Increments the reference count by one.

Parameters

  • hDefn: handle to the feature definition on witch OGRFeature are based on.

Returns

the updated reference count.

GDAL.ogr_fd_releaseMethod
OGR_FD_Release(OGRFeatureDefnH hDefn) -> void

Drop a reference, and destroy if unreferenced.

Parameters

  • hDefn: handle to the feature definition to be released.
GDAL.ogr_fd_reorderfielddefnsMethod
OGR_FD_ReorderFieldDefns(OGRFeatureDefnH hDefn,
                         const int * panMap) -> OGRErr

Reorder the field definitions in the array of the feature definition.

Parameters

  • hDefn: handle to the feature definition.
  • panMap: an array of GetFieldCount() elements which is a permutation of [0, GetFieldCount()-1]. panMap is such that, for each field definition at position i after reordering, its position before reordering was panMap[i].

Returns

OGRERR_NONE in case of success.

GDAL.ogr_fd_setgeometryignoredMethod
OGR_FD_SetGeometryIgnored(OGRFeatureDefnH hDefn,
                          int bIgnore) -> void

Set whether the geometry can be omitted when fetching features.

Parameters

  • hDefn: handle to the feature definition on witch OGRFeature are based on.
  • bIgnore: ignore state
GDAL.ogr_fd_setgeomtypeMethod
OGR_FD_SetGeomType(OGRFeatureDefnH hDefn,
                   OGRwkbGeometryType eType) -> void

Assign the base geometry type for the passed layer (the same as the feature definition).

Parameters

  • hDefn: handle to the layer or feature definition to set the geometry type to.
  • eType: the new type to assign.
GDAL.ogr_fd_setstyleignoredMethod
OGR_FD_SetStyleIgnored(OGRFeatureDefnH hDefn,
                       int bIgnore) -> void

Set whether the style can be omitted when fetching features.

Parameters

  • hDefn: handle to the feature definition on witch OGRFeature are based on.
  • bIgnore: ignore state
GDAL.ogr_fld_createMethod
OGR_Fld_Create(const char * pszName,
               OGRFieldType eType) -> OGRFieldDefnH

Create a new field definition.

Parameters

  • pszName: the name of the new field definition.
  • eType: the type of the new field definition.

Returns

handle to the new field definition.

GDAL.ogr_fld_destroyMethod
OGR_Fld_Destroy(OGRFieldDefnH hDefn) -> void

Destroy a field definition.

Parameters

  • hDefn: handle to the field definition to destroy.
GDAL.ogr_fld_getalternativenamerefMethod
OGR_Fld_GetAlternativeNameRef(OGRFieldDefnH hDefn) -> const char *

Fetch the alternative name (or "alias") for this field.

Parameters

  • hDefn: handle to the field definition.

Returns

the alternative name of the field definition.

GDAL.ogr_fld_getcommentMethod
OGR_Fld_GetComment(OGRFieldDefnH hDefn) -> const char *

Return the (optional) comment for this field.

Parameters

  • hDefn: handle to the field definition

Returns

the comment, or an empty string if there is none.

GDAL.ogr_fld_getdefaultMethod
OGR_Fld_GetDefault(OGRFieldDefnH hDefn) -> const char *

Get default field value.

Parameters

  • hDefn: handle to the field definition.

Returns

default field value or NULL.

GDAL.ogr_fld_getdomainnameMethod
OGR_Fld_GetDomainName(OGRFieldDefnH hDefn) -> const char *

Return the name of the field domain for this field.

Parameters

  • hDefn: handle to the field definition

Returns

the field domain name, or an empty string if there is none.

GDAL.ogr_fld_getjustifyMethod
OGR_Fld_GetJustify(OGRFieldDefnH hDefn) -> OGRJustification

Get the justification for this field.

Parameters

  • hDefn: handle to the field definition to get justification from.

Returns

the justification.

GDAL.ogr_fld_getnamerefMethod
OGR_Fld_GetNameRef(OGRFieldDefnH hDefn) -> const char *

Fetch name of this field.

Parameters

  • hDefn: handle to the field definition.

Returns

the name of the field definition.

GDAL.ogr_fld_getprecisionMethod
OGR_Fld_GetPrecision(OGRFieldDefnH hDefn) -> int

Get the formatting precision for this field.

Parameters

  • hDefn: handle to the field definition to get precision from.

Returns

the precision.

GDAL.ogr_fld_getsubtypeMethod
OGR_Fld_GetSubType(OGRFieldDefnH hDefn) -> OGRFieldSubType

Fetch subtype of this field.

Parameters

  • hDefn: handle to the field definition to get subtype from.

Returns

field subtype.

GDAL.ogr_fld_gettypeMethod
OGR_Fld_GetType(OGRFieldDefnH hDefn) -> OGRFieldType

Fetch type of this field.

Parameters

  • hDefn: handle to the field definition to get type from.

Returns

field type.

GDAL.ogr_fld_getwidthMethod
OGR_Fld_GetWidth(OGRFieldDefnH hDefn) -> int

Get the formatting width for this field.

Parameters

  • hDefn: handle to the field definition to get width from.

Returns

the width, zero means no specified width.

GDAL.ogr_fld_isdefaultdriverspecificMethod
OGR_Fld_IsDefaultDriverSpecific(OGRFieldDefnH hDefn) -> int

Returns whether the default value is driver specific.

Parameters

  • hDefn: handle to the field definition

Returns

TRUE if the default value is driver specific.

GDAL.ogr_fld_isignoredMethod
OGR_Fld_IsIgnored(OGRFieldDefnH hDefn) -> int

Return whether this field should be omitted when fetching features.

Parameters

  • hDefn: handle to the field definition

Returns

ignore state

GDAL.ogr_fld_isnullableMethod
OGR_Fld_IsNullable(OGRFieldDefnH hDefn) -> int

Return whether this field can receive null values.

Parameters

  • hDefn: handle to the field definition

Returns

TRUE if the field is authorized to be null.

GDAL.ogr_fld_isuniqueMethod
OGR_Fld_IsUnique(OGRFieldDefnH hDefn) -> int

Return whether this field has a unique constraint.

Parameters

  • hDefn: handle to the field definition

Returns

TRUE if the field has a unique constraint.

GDAL.ogr_fld_setMethod
OGR_Fld_Set(OGRFieldDefnH hDefn,
            const char * pszNameIn,
            OGRFieldType eTypeIn,
            int nWidthIn,
            int nPrecisionIn,
            OGRJustification eJustifyIn) -> void

Set defining parameters for a field in one call.

Parameters

  • hDefn: handle to the field definition to set to.
  • pszNameIn: the new name to assign.
  • eTypeIn: the new type (one of the OFT values like OFTInteger).
  • nWidthIn: the preferred formatting width. Defaults to zero indicating undefined.
  • nPrecisionIn: number of decimals places for formatting, defaults to zero indicating undefined.
  • eJustifyIn: the formatting justification (OJLeft or OJRight), defaults to OJUndefined.
GDAL.ogr_fld_setalternativenameMethod
OGR_Fld_SetAlternativeName(OGRFieldDefnH hDefn,
                           const char * pszAlternativeName) -> void

Reset the alternative name (or "alias") for this field.

Parameters

  • hDefn: handle to the field definition to apply the new alternative name to.
  • pszAlternativeName: the new alternative name to apply.
GDAL.ogr_fld_setcommentMethod
OGR_Fld_SetComment(OGRFieldDefnH hDefn,
                   const char * pszComment) -> void

Set the comment for this field.

Parameters

  • hDefn: handle to the field definition
  • pszComment: Field comment.
GDAL.ogr_fld_setdefaultMethod
OGR_Fld_SetDefault(OGRFieldDefnH hDefn,
                   const char * pszDefault) -> void

Set default field value.

Parameters

  • hDefn: handle to the field definition.
  • pszDefault: new default field value or NULL pointer.
GDAL.ogr_fld_setdomainnameMethod
OGR_Fld_SetDomainName(OGRFieldDefnH hDefn,
                      const char * pszFieldName) -> void

Set the name of the field domain for this field.

Parameters

  • hDefn: handle to the field definition
  • pszFieldName: Field domain name.
GDAL.ogr_fld_setignoredMethod
OGR_Fld_SetIgnored(OGRFieldDefnH hDefn,
                   int ignore) -> void

Set whether this field should be omitted when fetching features.

Parameters

  • hDefn: handle to the field definition
  • ignore: ignore state
GDAL.ogr_fld_setjustifyMethod
OGR_Fld_SetJustify(OGRFieldDefnH hDefn,
                   OGRJustification eJustify) -> void

Set the justification for this field.

Parameters

  • hDefn: handle to the field definition to set justification to.
  • eJustify: the new justification.
GDAL.ogr_fld_setnameMethod
OGR_Fld_SetName(OGRFieldDefnH hDefn,
                const char * pszName) -> void

Reset the name of this field.

Parameters

  • hDefn: handle to the field definition to apply the new name to.
  • pszName: the new name to apply.
GDAL.ogr_fld_setnullableMethod
OGR_Fld_SetNullable(OGRFieldDefnH hDefn,
                    int bNullableIn) -> void

Set whether this field can receive null values.

Parameters

  • hDefn: handle to the field definition
  • bNullableIn: FALSE if the field must have a not-null constraint.
GDAL.ogr_fld_setprecisionMethod
OGR_Fld_SetPrecision(OGRFieldDefnH hDefn,
                     int nPrecision) -> void

Set the formatting precision for this field in characters.

Parameters

  • hDefn: handle to the field definition to set precision to.
  • nPrecision: the new precision.
GDAL.ogr_fld_setsubtypeMethod
OGR_Fld_SetSubType(OGRFieldDefnH hDefn,
                   OGRFieldSubType eSubType) -> void

Set the subtype of this field.

Parameters

  • hDefn: handle to the field definition to set type to.
  • eSubType: the new field subtype.
GDAL.ogr_fld_settypeMethod
OGR_Fld_SetType(OGRFieldDefnH hDefn,
                OGRFieldType eType) -> void

Set the type of this field.

Parameters

  • hDefn: handle to the field definition to set type to.
  • eType: the new field type.
GDAL.ogr_fld_setuniqueMethod
OGR_Fld_SetUnique(OGRFieldDefnH hDefn,
                  int bUniqueIn) -> void

Set whether this field has a unique constraint.

Parameters

  • hDefn: handle to the field definition
  • bUniqueIn: TRUE if the field must have a unique constraint.
GDAL.ogr_fld_setwidthMethod
OGR_Fld_SetWidth(OGRFieldDefnH hDefn,
                 int nNewWidth) -> void

Set the formatting width for this field in characters.

Parameters

  • hDefn: handle to the field definition to set width to.
  • nNewWidth: the new width.
GDAL.ogr_flddomain_destroyMethod
OGR_FldDomain_Destroy(OGRFieldDomainH hFieldDomain) -> void

Destroy a field domain.

Parameters

  • hFieldDomain: the field domain.
GDAL.ogr_flddomain_getdescriptionMethod
OGR_FldDomain_GetDescription(OGRFieldDomainH hFieldDomain) -> const char *

Get the description of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the field domain description (might be empty string).

GDAL.ogr_flddomain_getdomaintypeMethod
OGR_FldDomain_GetDomainType(OGRFieldDomainH hFieldDomain) -> OGRFieldDomainType

Get the type of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the type of the field domain.

GDAL.ogr_flddomain_getfieldsubtypeMethod
OGR_FldDomain_GetFieldSubType(OGRFieldDomainH hFieldDomain) -> OGRFieldSubType

Get the field subtype of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the field subtype of the field domain.

GDAL.ogr_flddomain_getfieldtypeMethod
OGR_FldDomain_GetFieldType(OGRFieldDomainH hFieldDomain) -> OGRFieldType

Get the field type of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the field type of the field domain.

GDAL.ogr_flddomain_getmergepolicyMethod
OGR_FldDomain_GetMergePolicy(OGRFieldDomainH hFieldDomain) -> OGRFieldDomainMergePolicy

Get the split policy of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the split policy of the field domain.

GDAL.ogr_flddomain_getnameMethod
OGR_FldDomain_GetName(OGRFieldDomainH hFieldDomain) -> const char *

Get the name of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the field domain name.

GDAL.ogr_flddomain_getsplitpolicyMethod
OGR_FldDomain_GetSplitPolicy(OGRFieldDomainH hFieldDomain) -> OGRFieldDomainSplitPolicy

Get the split policy of the field domain.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the split policy of the field domain.

GDAL.ogr_flddomain_setmergepolicyMethod
OGR_FldDomain_SetMergePolicy(OGRFieldDomainH hFieldDomain,
                             OGRFieldDomainMergePolicy policy) -> void

Set the split policy of the field domain.

Parameters

  • hFieldDomain: Field domain handle.
  • policy: the split policy of the field domain.
GDAL.ogr_flddomain_setsplitpolicyMethod
OGR_FldDomain_SetSplitPolicy(OGRFieldDomainH hFieldDomain,
                             OGRFieldDomainSplitPolicy policy) -> void

Set the split policy of the field domain.

Parameters

  • hFieldDomain: Field domain handle.
  • policy: the split policy of the field domain.
GDAL.ogr_g_addgeometryMethod
OGR_G_AddGeometry(OGRGeometryH hGeom,
                  OGRGeometryH hNewSubGeom) -> OGRErr

Add a geometry to a geometry container.

Parameters

  • hGeom: existing geometry container.
  • hNewSubGeom: geometry to add to the container.

Returns

OGRERRNONE if successful, or OGRERRUNSUPPORTEDGEOMETRYTYPE if the geometry type is illegal for the type of existing geometry.

GDAL.ogr_g_addgeometrydirectlyMethod
OGR_G_AddGeometryDirectly(OGRGeometryH hGeom,
                          OGRGeometryH hNewSubGeom) -> OGRErr

Add a geometry directly to an existing geometry container.

Parameters

  • hGeom: existing geometry.
  • hNewSubGeom: geometry to add to the existing geometry.

Returns

OGRERRNONE if successful, or OGRERRUNSUPPORTEDGEOMETRYTYPE if the geometry type is illegal for the type of geometry container.

GDAL.ogr_g_addpointMethod
OGR_G_AddPoint(OGRGeometryH hGeom,
               double dfX,
               double dfY,
               double dfZ) -> void

Add a point to a geometry (line string or point).

Parameters

  • hGeom: handle to the geometry to add a point to.
  • dfX: x coordinate of point to add.
  • dfY: y coordinate of point to add.
  • dfZ: z coordinate of point to add.
GDAL.ogr_g_addpoint_2dMethod
OGR_G_AddPoint_2D(OGRGeometryH hGeom,
                  double dfX,
                  double dfY) -> void

Add a point to a geometry (line string or point).

Parameters

  • hGeom: handle to the geometry to add a point to.
  • dfX: x coordinate of point to add.
  • dfY: y coordinate of point to add.
GDAL.ogr_g_addpointmMethod
OGR_G_AddPointM(OGRGeometryH hGeom,
                double dfX,
                double dfY,
                double dfM) -> void

Add a point to a geometry (line string or point).

Parameters

  • hGeom: handle to the geometry to add a point to.
  • dfX: x coordinate of point to add.
  • dfY: y coordinate of point to add.
  • dfM: m coordinate of point to add.
GDAL.ogr_g_addpointzmMethod
OGR_G_AddPointZM(OGRGeometryH hGeom,
                 double dfX,
                 double dfY,
                 double dfZ,
                 double dfM) -> void

Add a point to a geometry (line string or point).

Parameters

  • hGeom: handle to the geometry to add a point to.
  • dfX: x coordinate of point to add.
  • dfY: y coordinate of point to add.
  • dfZ: z coordinate of point to add.
  • dfM: m coordinate of point to add.
GDAL.ogr_g_approximatearcanglesMethod
OGR_G_ApproximateArcAngles(double dfCenterX,
                           double dfCenterY,
                           double dfZ,
                           double dfPrimaryRadius,
                           double dfSecondaryRadius,
                           double dfRotation,
                           double dfStartAngle,
                           double dfEndAngle,
                           double dfMaxAngleStepSizeDegrees) -> OGRGeometryH

Stroke arc to linestring.

Parameters

  • dfCenterX: center X
  • dfCenterY: center Y
  • dfZ: center Z
  • dfPrimaryRadius: X radius of ellipse.
  • dfSecondaryRadius: Y radius of ellipse.
  • dfRotation: rotation of the ellipse clockwise.
  • dfStartAngle: angle to first point on arc (clockwise of X-positive)
  • dfEndAngle: angle to last point on arc (clockwise of X-positive)
  • dfMaxAngleStepSizeDegrees: the largest step in degrees along the arc, zero to use the default setting.

Returns

OGRLineString geometry representing an approximation of the arc.

GDAL.ogr_g_areaMethod
OGR_G_Area(OGRGeometryH hGeom) -> double

Compute geometry area.

Parameters

  • hGeom: the geometry to operate on.

Returns

the area or 0.0 for unsupported geometry types.

GDAL.ogr_g_assignspatialreferenceMethod
OGR_G_AssignSpatialReference(OGRGeometryH hGeom,
                             OGRSpatialReferenceH hSRS) -> void

Assign spatial reference to this object.

Parameters

  • hGeom: handle on the geometry to apply the new spatial reference system.
  • hSRS: handle on the new spatial reference system to apply.
GDAL.ogr_g_boundaryMethod
OGR_G_Boundary(OGRGeometryH hTarget) -> OGRGeometryH

Compute boundary.

Parameters

  • hTarget: The Geometry to calculate the boundary of.

Returns

a handle to a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_bufferMethod
OGR_G_Buffer(OGRGeometryH hTarget,
             double dfDist,
             int nQuadSegs) -> OGRGeometryH

Compute buffer of geometry.

Parameters

  • hTarget: the geometry.
  • dfDist: the buffer distance to be applied. Should be expressed into the same unit as the coordinates of the geometry.
  • nQuadSegs: the number of segments used to approximate a 90 degree (quadrant) of curvature.

Returns

the newly created geometry, or NULL if an error occurs.

GDAL.ogr_g_centroidMethod
OGR_G_Centroid(OGRGeometryH hGeom,
               OGRGeometryH hCentroidPoint) -> int

Compute the geometry centroid.

Returns

OGRERRNONE on success or OGRERRFAILURE on error.

GDAL.ogr_g_cloneMethod
OGR_G_Clone(OGRGeometryH hGeom) -> OGRGeometryH

Make a copy of this object.

Parameters

  • hGeom: handle on the geometry to clone from.

Returns

a handle on the copy of the geometry with the spatial reference system as the original.

GDAL.ogr_g_closeringsMethod
OGR_G_CloseRings(OGRGeometryH hGeom) -> void

Force rings to be closed.

Parameters

  • hGeom: handle to the geometry.
GDAL.ogr_g_concavehullMethod
OGR_G_ConcaveHull(OGRGeometryH hTarget,
                  double dfRatio,
                  bool bAllowHoles) -> OGRGeometryH

Compute "concave hull" of a geometry.

Parameters

  • hTarget: The Geometry to calculate the concave hull of.
  • dfRatio: Ratio of the area of the convex hull and the concave hull.
  • bAllowHoles: Whether holes are allowed.

Returns

a handle to a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_containsMethod
OGR_G_Contains(OGRGeometryH hThis,
               OGRGeometryH hOther) -> int

Test for containment.

Parameters

  • hThis: the geometry to compare.
  • hOther: the other geometry to compare.

Returns

TRUE if hThis contains hOther geometry, otherwise FALSE.

GDAL.ogr_g_convexhullMethod
OGR_G_ConvexHull(OGRGeometryH hTarget) -> OGRGeometryH

Compute convex hull.

Parameters

  • hTarget: The Geometry to calculate the convex hull of.

Returns

a handle to a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_coordinatedimensionMethod
OGR_G_CoordinateDimension(OGRGeometryH hGeom) -> int

Get the dimension of the coordinates in this geometry.

Parameters

  • hGeom: handle on the geometry to get the dimension of the coordinates from.

Returns

this will return 2 for XY, 3 for XYZ and XYM, and 4 for XYZM data.

GDAL.ogr_g_createfromfgfMethod
OGR_G_CreateFromFgf(const void * pabyData,
                    OGRSpatialReferenceH hSRS,
                    OGRGeometryH * phGeometry,
                    int nBytes,
                    int * pnBytesConsumed) -> OGRErr

Create a geometry object of the appropriate type from its FGF (FDO Geometry Format) binary representation.

GDAL.ogr_g_createfromgmlMethod
OGR_G_CreateFromGML(const char * pszGML) -> OGRGeometryH

Create geometry from GML.

Parameters

  • pszGML: The GML fragment for the geometry.

Returns

a geometry on success, or NULL on error.

GDAL.ogr_g_createfromwkbMethod
OGR_G_CreateFromWkb(const void * pabyData,
                    OGRSpatialReferenceH hSRS,
                    OGRGeometryH * phGeometry,
                    int nBytes) -> OGRErr

Create a geometry object of the appropriate type from its well known binary representation.

Parameters

  • pabyData: pointer to the input BLOB data.
  • hSRS: handle to the spatial reference to be assigned to the created geometry object. This may be NULL.
  • phGeometry: the newly created geometry object will be assigned to the indicated handle on return. This will be NULL in case of failure. If not NULL, *phGeometry should be freed with OGRGDestroyGeometry() after use.
  • nBytes: the number of bytes of data available in pabyData, or -1 if it is not known, but assumed to be sufficient.

Returns

OGRERRNONE if all goes well, otherwise any of OGRERRNOTENOUGHDATA, OGRERRUNSUPPORTEDGEOMETRYTYPE, or OGRERRCORRUPT_DATA may be returned.

GDAL.ogr_g_createfromwkbexMethod
OGR_G_CreateFromWkbEx(const void * pabyData,
                      OGRSpatialReferenceH hSRS,
                      OGRGeometryH * phGeometry,
                      size_t nBytes) -> OGRErr

Create a geometry object of the appropriate type from its well known binary representation.

Parameters

  • pabyData: pointer to the input BLOB data.
  • hSRS: handle to the spatial reference to be assigned to the created geometry object. This may be NULL.
  • phGeometry: the newly created geometry object will be assigned to the indicated handle on return. This will be NULL in case of failure. If not NULL, *phGeometry should be freed with OGRGDestroyGeometry() after use.
  • nBytes: the number of bytes of data available in pabyData, or -1 if it is not known, but assumed to be sufficient.

Returns

OGRERRNONE if all goes well, otherwise any of OGRERRNOTENOUGHDATA, OGRERRUNSUPPORTEDGEOMETRYTYPE, or OGRERRCORRUPT_DATA may be returned.

GDAL.ogr_g_createfromwktMethod
OGR_G_CreateFromWkt(char ** ppszData,
                    OGRSpatialReferenceH hSRS,
                    OGRGeometryH * phGeometry) -> OGRErr

Create a geometry object of the appropriate type from its well known text representation.

Parameters

  • ppszData: input zero terminated string containing well known text representation of the geometry to be created. The pointer is updated to point just beyond that last character consumed.
  • hSRS: handle to the spatial reference to be assigned to the created geometry object. This may be NULL.
  • phGeometry: the newly created geometry object will be assigned to the indicated handle on return. This will be NULL if the method fails. If not NULL, *phGeometry should be freed with OGRGDestroyGeometry() after use.

Returns

OGRERRNONE if all goes well, otherwise any of OGRERRNOTENOUGHDATA, OGRERRUNSUPPORTEDGEOMETRYTYPE, or OGRERRCORRUPT_DATA may be returned.

GDAL.ogr_g_creategeometryMethod
OGR_G_CreateGeometry(OGRwkbGeometryType eGeometryType) -> OGRGeometryH

Create an empty geometry of desired type.

Parameters

  • eGeometryType: the type code of the geometry to be created.

Returns

handle to the newly create geometry or NULL on failure. Should be freed with OGRGDestroyGeometry() after use.

GDAL.ogr_g_crossesMethod
OGR_G_Crosses(OGRGeometryH hThis,
              OGRGeometryH hOther) -> int

Test for crossing.

Parameters

  • hThis: the geometry to compare.
  • hOther: the other geometry to compare.

Returns

TRUE if they are crossing, otherwise FALSE.

GDAL.ogr_g_delaunaytriangulationMethod
OGR_G_DelaunayTriangulation(OGRGeometryH hThis,
                            double dfTolerance,
                            int bOnlyEdges) -> OGRGeometryH

Return a Delaunay triangulation of the vertices of the geometry.

Parameters

  • hThis: the geometry.
  • dfTolerance: optional snapping tolerance to use for improved robustness
  • bOnlyEdges: if TRUE, will return a MULTILINESTRING, otherwise it will return a GEOMETRYCOLLECTION containing triangular POLYGONs.

Returns

the geometry resulting from the Delaunay triangulation or NULL if an error occurs.

GDAL.ogr_g_destroygeometryMethod
OGR_G_DestroyGeometry(OGRGeometryH hGeom) -> void

Destroy geometry object.

Parameters

  • hGeom: handle to the geometry to delete.
GDAL.ogr_g_differenceMethod
OGR_G_Difference(OGRGeometryH hThis,
                 OGRGeometryH hOther) -> OGRGeometryH

Compute difference.

Parameters

  • hThis: the geometry.
  • hOther: the other geometry.

Returns

a new geometry representing the difference or NULL if the difference is empty or an error occurs.

GDAL.ogr_g_disjointMethod
OGR_G_Disjoint(OGRGeometryH hThis,
               OGRGeometryH hOther) -> int

Test for disjointness.

Parameters

  • hThis: the geometry to compare.
  • hOther: the other geometry to compare.

Returns

TRUE if they are disjoint, otherwise FALSE.

GDAL.ogr_g_distanceMethod
OGR_G_Distance(OGRGeometryH hFirst,
               OGRGeometryH hOther) -> double

Compute distance between two geometries.

Parameters

  • hFirst: the first geometry to compare against.
  • hOther: the other geometry to compare against.

Returns

the distance between the geometries or -1 if an error occurs.

GDAL.ogr_g_distance3dMethod
OGR_G_Distance3D(OGRGeometryH hFirst,
                 OGRGeometryH hOther) -> double

Returns the 3D distance between two geometries.

Parameters

  • hFirst: the first geometry to compare against.
  • hOther: the other geometry to compare against.

Returns

distance between the two geometries

GDAL.ogr_g_dumpreadableMethod
OGR_G_DumpReadable(OGRGeometryH hGeom,
                   FILE * fp,
                   const char * pszPrefix) -> void

Dump geometry in well known text format to indicated output file.

Parameters

  • hGeom: handle on the geometry to dump.
  • fp: the text file to write the geometry to.
  • pszPrefix: the prefix to put on each line of output.
GDAL.ogr_g_emptyMethod
OGR_G_Empty(OGRGeometryH hGeom) -> void

Clear geometry information.

Parameters

  • hGeom: handle on the geometry to empty.
GDAL.ogr_g_equalsMethod
OGR_G_Equals(OGRGeometryH hGeom,
             OGRGeometryH hOther) -> int

Returns TRUE if two geometries are equivalent.

Parameters

  • hGeom: handle on the first geometry.
  • hOther: handle on the other geometry to test against.

Returns

TRUE if equivalent or FALSE otherwise.

GDAL.ogr_g_exporttogmlMethod
OGR_G_ExportToGML(OGRGeometryH hGeometry) -> char *

Convert a geometry into GML format.

Parameters

  • hGeometry: handle to the geometry.

Returns

A GML fragment or NULL in case of error.

GDAL.ogr_g_exporttogmlexMethod
OGR_G_ExportToGMLEx(OGRGeometryH hGeometry,
                    char ** papszOptions) -> char *

Convert a geometry into GML format.

Parameters

  • hGeometry: handle to the geometry.
  • papszOptions: NULL-terminated list of options.

Returns

A GML fragment or NULL in case of error.

GDAL.ogr_g_exporttogmltreeMethod
OGR_G_ExportToGMLTree(OGRGeometryH hGeometry) -> CPLXMLNode *

Convert a geometry into GML format.

GDAL.ogr_g_exporttoisowkbMethod
OGR_G_ExportToIsoWkb(OGRGeometryH hGeom,
                     OGRwkbByteOrder eOrder,
                     unsigned char * pabyDstBuffer) -> OGRErr

Convert a geometry into SFSQL 1.2 / ISO SQL/MM Part 3 well known binary format.

Parameters

  • hGeom: handle on the geometry to convert to a well know binary data from.
  • eOrder: One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
  • pabyDstBuffer: a buffer into which the binary representation is written. This buffer must be at least OGRGWkbSize() byte in size.

Returns

Currently OGRERR_NONE is always returned.

GDAL.ogr_g_exporttoisowktMethod
OGR_G_ExportToIsoWkt(OGRGeometryH hGeom,
                     char ** ppszSrcText) -> OGRErr

Convert a geometry into SFSQL 1.2 / ISO SQL/MM Part 3 well known text format.

Parameters

  • hGeom: handle on the geometry to convert to a text format from.
  • ppszSrcText: a text buffer is allocated by the program, and assigned to the passed pointer. After use, *ppszDstText should be freed with CPLFree().

Returns

Currently OGRERR_NONE is always returned.

GDAL.ogr_g_exporttojsonMethod
OGR_G_ExportToJson(OGRGeometryH hGeometry) -> char *

Convert a geometry into GeoJSON format.

Parameters

  • hGeometry: handle to the geometry.

Returns

A GeoJSON fragment or NULL in case of error.

GDAL.ogr_g_exporttojsonexMethod
OGR_G_ExportToJsonEx(OGRGeometryH hGeometry,
                     char ** papszOptions) -> char *

Convert a geometry into GeoJSON format.

Parameters

  • hGeometry: handle to the geometry.
  • papszOptions: a null terminated list of options.

Returns

A GeoJSON fragment or NULL in case of error.

GDAL.ogr_g_exporttokmlMethod
OGR_G_ExportToKML(OGRGeometryH hGeometry,
                  const char * pszAltitudeMode) -> char *

Convert a geometry into KML format.

Parameters

  • hGeometry: handle to the geometry.
  • pszAltitudeMode: value to write in altitudeMode element, or NULL.

Returns

A KML fragment or NULL in case of error.

GDAL.ogr_g_exporttowkbMethod
OGR_G_ExportToWkb(OGRGeometryH hGeom,
                  OGRwkbByteOrder eOrder,
                  unsigned char * pabyDstBuffer) -> OGRErr

Convert a geometry well known binary format.

Parameters

  • hGeom: handle on the geometry to convert to a well know binary data from.
  • eOrder: One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
  • pabyDstBuffer: a buffer into which the binary representation is written. This buffer must be at least OGRGWkbSize() byte in size.

Returns

Currently OGRERR_NONE is always returned.

GDAL.ogr_g_exporttowktMethod
OGR_G_ExportToWkt(OGRGeometryH hGeom,
                  char ** ppszSrcText) -> OGRErr

Convert a geometry into well known text format.

Parameters

  • hGeom: handle on the geometry to convert to a text format from.
  • ppszSrcText: a text buffer is allocated by the program, and assigned to the passed pointer. After use, *ppszDstText should be freed with CPLFree().

Returns

Currently OGRERR_NONE is always returned.

GDAL.ogr_g_flattento2dMethod
OGR_G_FlattenTo2D(OGRGeometryH hGeom) -> void

Convert geometry to strictly 2D.

Parameters

  • hGeom: handle on the geometry to convert.
GDAL.ogr_g_forcetoMethod
OGR_G_ForceTo(OGRGeometryH hGeom,
              OGRwkbGeometryType eTargetType,
              char ** papszOptions) -> OGRGeometryH

Convert to another geometry type.

Parameters

  • hGeom: the input geometry - ownership is passed to the method.
  • eTargetType: target output geometry type.
  • papszOptions: options as a null-terminated list of strings or NULL.

Returns

new geometry.

GDAL.ogr_g_forcetolinestringMethod
OGR_G_ForceToLineString(OGRGeometryH hGeom) -> OGRGeometryH

Convert to line string.

Parameters

  • hGeom: handle to the geometry to convert (ownership surrendered).

Returns

the converted geometry (ownership to caller).

GDAL.ogr_g_forcetomultilinestringMethod
OGR_G_ForceToMultiLineString(OGRGeometryH hGeom) -> OGRGeometryH

Convert to multilinestring.

Parameters

  • hGeom: handle to the geometry to convert (ownership surrendered).

Returns

the converted geometry (ownership to caller).

GDAL.ogr_g_forcetomultipointMethod
OGR_G_ForceToMultiPoint(OGRGeometryH hGeom) -> OGRGeometryH

Convert to multipoint.

Parameters

  • hGeom: handle to the geometry to convert (ownership surrendered).

Returns

the converted geometry (ownership to caller).

GDAL.ogr_g_forcetomultipolygonMethod
OGR_G_ForceToMultiPolygon(OGRGeometryH hGeom) -> OGRGeometryH

Convert to multipolygon.

Parameters

  • hGeom: handle to the geometry to convert (ownership surrendered).

Returns

the converted geometry (ownership to caller).

GDAL.ogr_g_forcetopolygonMethod
OGR_G_ForceToPolygon(OGRGeometryH hGeom) -> OGRGeometryH

Convert to polygon.

Parameters

  • hGeom: handle to the geometry to convert (ownership surrendered).

Returns

the converted geometry (ownership to caller).

GDAL.ogr_g_getareaMethod
OGR_G_GetArea(OGRGeometryH hGeom) -> double

Compute geometry area (deprecated)

GDAL.ogr_g_getboundaryMethod
OGR_G_GetBoundary(OGRGeometryH hTarget) -> OGRGeometryH

Compute boundary (deprecated)

GDAL.ogr_g_getcoordinatedimensionMethod
OGR_G_GetCoordinateDimension(OGRGeometryH hGeom) -> int

Get the dimension of the coordinates in this geometry.

Parameters

  • hGeom: handle on the geometry to get the dimension of the coordinates from.

Returns

this will return 2 or 3.

GDAL.ogr_g_getcurvegeometryMethod
OGR_G_GetCurveGeometry(OGRGeometryH hGeom,
                       char ** papszOptions) -> OGRGeometryH

Return curve version of this geometry.

Parameters

  • hGeom: the geometry to operate on.
  • papszOptions: options as a null-terminated list of strings. Unused for now. Must be set to NULL.

Returns

a new geometry.

GDAL.ogr_g_getdimensionMethod
OGR_G_GetDimension(OGRGeometryH hGeom) -> int

Get the dimension of this geometry.

Parameters

  • hGeom: handle on the geometry to get the dimension from.

Returns

0 for points, 1 for lines and 2 for surfaces.

GDAL.ogr_g_getenvelopeMethod
OGR_G_GetEnvelope(OGRGeometryH hGeom,
                  OGREnvelope * psEnvelope) -> void

Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.

Parameters

  • hGeom: handle of the geometry to get envelope from.
  • psEnvelope: the structure in which to place the results.
GDAL.ogr_g_getenvelope3dMethod
OGR_G_GetEnvelope3D(OGRGeometryH hGeom,
                    OGREnvelope3D * psEnvelope) -> void

Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.

Parameters

  • hGeom: handle of the geometry to get envelope from.
  • psEnvelope: the structure in which to place the results.
GDAL.ogr_g_getgeometrycountMethod
OGR_G_GetGeometryCount(OGRGeometryH hGeom) -> int

Fetch the number of elements in a geometry or number of geometries in container.

Parameters

  • hGeom: single geometry or geometry container from which to get the number of elements.

Returns

the number of elements.

GDAL.ogr_g_getgeometrynameMethod
OGR_G_GetGeometryName(OGRGeometryH hGeom) -> const char *

Fetch WKT name for geometry type.

Parameters

  • hGeom: handle on the geometry to get name from.

Returns

name used for this geometry type in well known text format.

GDAL.ogr_g_getgeometryrefMethod
OGR_G_GetGeometryRef(OGRGeometryH hGeom,
                     int iSubGeom) -> OGRGeometryH

Fetch geometry from a geometry container.

Parameters

  • hGeom: handle to the geometry container from which to get a geometry from.
  • iSubGeom: the index of the geometry to fetch, between 0 and getNumGeometries() - 1.

Returns

handle to the requested geometry.

GDAL.ogr_g_getgeometrytypeMethod
OGR_G_GetGeometryType(OGRGeometryH hGeom) -> OGRwkbGeometryType

Fetch geometry type.

Parameters

  • hGeom: handle on the geometry to get type from.

Returns

the geometry type code.

GDAL.ogr_g_getlineargeometryMethod
OGR_G_GetLinearGeometry(OGRGeometryH hGeom,
                        double dfMaxAngleStepSizeDegrees,
                        char ** papszOptions) -> OGRGeometryH

Return, possibly approximate, linear version of this geometry.

Parameters

  • hGeom: the geometry to operate on.
  • dfMaxAngleStepSizeDegrees: the largest step in degrees along the arc, zero to use the default setting.
  • papszOptions: options as a null-terminated list of strings or NULL. See OGRGeometryFactory::curveToLineString() for valid options.

Returns

a new geometry.

GDAL.ogr_g_getmMethod
OGR_G_GetM(OGRGeometryH hGeom,
           int i) -> double

Fetch the m coordinate of a point from a geometry.

Parameters

  • hGeom: handle to the geometry from which to get the M coordinate.
  • i: point to get the M coordinate.

Returns

the M coordinate of this point.

GDAL.ogr_g_getpointMethod
OGR_G_GetPoint(OGRGeometryH hGeom,
               int i,
               double * pdfX,
               double * pdfY,
               double * pdfZ) -> void

Fetch a point in line string or a point geometry.

Parameters

  • hGeom: handle to the geometry from which to get the coordinates.
  • i: the vertex to fetch, from 0 to getNumPoints()-1, zero for a point.
  • pdfX: value of x coordinate.
  • pdfY: value of y coordinate.
  • pdfZ: value of z coordinate.
GDAL.ogr_g_getpointsMethod
OGR_G_GetPoints(OGRGeometryH hGeom,
                void * pabyX,
                int nXStride,
                void * pabyY,
                int nYStride,
                void * pabyZ,
                int nZStride) -> int

Returns all points of line string.

Parameters

  • hGeom: handle to the geometry from which to get the coordinates.
  • pabyX: a buffer of at least (sizeof(double) * nXStride * nPointCount) bytes, may be NULL.
  • nXStride: the number of bytes between 2 elements of pabyX.
  • pabyY: a buffer of at least (sizeof(double) * nYStride * nPointCount) bytes, may be NULL.
  • nYStride: the number of bytes between 2 elements of pabyY.
  • pabyZ: a buffer of at last size (sizeof(double) * nZStride * nPointCount) bytes, may be NULL.
  • nZStride: the number of bytes between 2 elements of pabyZ.

Returns

the number of points

GDAL.ogr_g_getpointszmMethod
OGR_G_GetPointsZM(OGRGeometryH hGeom,
                  void * pabyX,
                  int nXStride,
                  void * pabyY,
                  int nYStride,
                  void * pabyZ,
                  int nZStride,
                  void * pabyM,
                  int nMStride) -> int

Returns all points of line string.

Parameters

  • hGeom: handle to the geometry from which to get the coordinates.
  • pabyX: a buffer of at least (nXStride * nPointCount) bytes, may be NULL.
  • nXStride: the number of bytes between 2 elements of pabyX.
  • pabyY: a buffer of at least (nYStride * nPointCount) bytes, may be NULL.
  • nYStride: the number of bytes between 2 elements of pabyY.
  • pabyZ: a buffer of at last size (nZStride * nPointCount) bytes, may be NULL.
  • nZStride: the number of bytes between 2 elements of pabyZ.
  • pabyM: a buffer of at last size (nMStride * nPointCount) bytes, may be NULL.
  • nMStride: the number of bytes between 2 elements of pabyM.

Returns

the number of points

GDAL.ogr_g_getpointzmMethod
OGR_G_GetPointZM(OGRGeometryH hGeom,
                 int i,
                 double * pdfX,
                 double * pdfY,
                 double * pdfZ,
                 double * pdfM) -> void

Fetch a point in line string or a point geometry.

Parameters

  • hGeom: handle to the geometry from which to get the coordinates.
  • i: the vertex to fetch, from 0 to getNumPoints()-1, zero for a point.
  • pdfX: value of x coordinate.
  • pdfY: value of y coordinate.
  • pdfZ: value of z coordinate.
  • pdfM: value of m coordinate.
GDAL.ogr_g_getspatialreferenceMethod
OGR_G_GetSpatialReference(OGRGeometryH hGeom) -> OGRSpatialReferenceH

Returns spatial reference system for geometry.

Parameters

  • hGeom: handle on the geometry to get spatial reference from.

Returns

a reference to the spatial reference geometry, which should not be modified.

GDAL.ogr_g_getxMethod
OGR_G_GetX(OGRGeometryH hGeom,
           int i) -> double

Fetch the x coordinate of a point from a Point or a LineString/LinearRing geometry.

Parameters

  • hGeom: handle to the geometry from which to get the x coordinate.
  • i: point to get the x coordinate.

Returns

the X coordinate of this point.

GDAL.ogr_g_getyMethod
OGR_G_GetY(OGRGeometryH hGeom,
           int i) -> double

Fetch the x coordinate of a point from a Point or a LineString/LinearRing geometry.

Parameters

  • hGeom: handle to the geometry from which to get the y coordinate.
  • i: point to get the Y coordinate.

Returns

the Y coordinate of this point.

GDAL.ogr_g_getzMethod
OGR_G_GetZ(OGRGeometryH hGeom,
           int i) -> double

Fetch the z coordinate of a point from a Point or a LineString/LinearRing geometry.

Parameters

  • hGeom: handle to the geometry from which to get the Z coordinate.
  • i: point to get the Z coordinate.

Returns

the Z coordinate of this point.

GDAL.ogr_g_hascurvegeometryMethod
OGR_G_HasCurveGeometry(OGRGeometryH hGeom,
                       int bLookForNonLinear) -> int

Returns if this geometry is or has curve geometry.

Parameters

  • hGeom: the geometry to operate on.
  • bLookForNonLinear: set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.

Returns

TRUE if this geometry is or has curve geometry.

GDAL.ogr_g_importfromwkbMethod
OGR_G_ImportFromWkb(OGRGeometryH hGeom,
                    const void * pabyData,
                    int nSize) -> OGRErr

Assign geometry from well known binary data.

Parameters

  • hGeom: handle on the geometry to assign the well know binary data to.
  • pabyData: the binary input data.
  • nSize: the size of pabyData in bytes, or -1 if not known.

Returns

OGRERRNONE if all goes well, otherwise any of OGRERRNOTENOUGHDATA, OGRERRUNSUPPORTEDGEOMETRYTYPE, or OGRERRCORRUPT_DATA may be returned.

GDAL.ogr_g_importfromwktMethod
OGR_G_ImportFromWkt(OGRGeometryH hGeom,
                    char ** ppszSrcText) -> OGRErr

Assign geometry from well known text data.

Parameters

  • hGeom: handle on the geometry to assign well know text data to.
  • ppszSrcText: pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.

Returns

OGRERRNONE if all goes well, otherwise any of OGRERRNOTENOUGHDATA, OGRERRUNSUPPORTEDGEOMETRYTYPE, or OGRERRCORRUPT_DATA may be returned.

GDAL.ogr_g_intersectionMethod
OGR_G_Intersection(OGRGeometryH hThis,
                   OGRGeometryH hOther) -> OGRGeometryH

Compute intersection.

Parameters

  • hThis: the geometry.
  • hOther: the other geometry.

Returns

a new geometry representing the intersection or NULL if there is no intersection or an error occurs.

GDAL.ogr_g_intersectsMethod
OGR_G_Intersects(OGRGeometryH hGeom,
                 OGRGeometryH hOtherGeom) -> int

Do these features intersect?

Parameters

  • hGeom: handle on the first geometry.
  • hOtherGeom: handle on the other geometry to test against.

Returns

TRUE if the geometries intersect, otherwise FALSE.

GDAL.ogr_g_is3dMethod
OGR_G_Is3D(OGRGeometryH hGeom) -> int

See whether this geometry has Z coordinates.

Parameters

  • hGeom: handle on the geometry to check whether it has Z coordinates.

Returns

TRUE if the geometry has Z coordinates.

GDAL.ogr_g_isemptyMethod
OGR_G_IsEmpty(OGRGeometryH hGeom) -> int

Test if the geometry is empty.

Parameters

  • hGeom: The Geometry to test.

Returns

TRUE if the geometry has no points, otherwise FALSE.

GDAL.ogr_g_ismeasuredMethod
OGR_G_IsMeasured(OGRGeometryH hGeom) -> int

See whether this geometry is measured.

Parameters

  • hGeom: handle on the geometry to check whether it is measured.

Returns

TRUE if the geometry has M coordinates.

GDAL.ogr_g_isringMethod
OGR_G_IsRing(OGRGeometryH hGeom) -> int

Test if the geometry is a ring.

Parameters

  • hGeom: The Geometry to test.

Returns

TRUE if the geometry has no points, otherwise FALSE.

GDAL.ogr_g_issimpleMethod
OGR_G_IsSimple(OGRGeometryH hGeom) -> int

Returns TRUE if the geometry is simple.

Parameters

  • hGeom: The Geometry to test.

Returns

TRUE if object is simple, otherwise FALSE.

GDAL.ogr_g_isvalidMethod
OGR_G_IsValid(OGRGeometryH hGeom) -> int

Test if the geometry is valid.

Parameters

  • hGeom: The Geometry to test.

Returns

TRUE if the geometry has no points, otherwise FALSE.

GDAL.ogr_g_lengthMethod
OGR_G_Length(OGRGeometryH hGeom) -> double

Compute length of a geometry.

Parameters

  • hGeom: the geometry to operate on.

Returns

the length or 0.0 for unsupported geometry types.

GDAL.ogr_g_makevalidMethod
OGR_G_MakeValid(OGRGeometryH hGeom) -> OGRGeometryH

Attempts to make an invalid geometry valid without losing vertices.

Parameters

  • hGeom: The Geometry to make valid.

Returns

a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_makevalidexMethod
OGR_G_MakeValidEx(OGRGeometryH hGeom,
                  CSLConstList papszOptions) -> OGRGeometryH

Attempts to make an invalid geometry valid without losing vertices.

Parameters

  • hGeom: The Geometry to make valid.
  • papszOptions: Options.

Returns

a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_normalizeMethod
OGR_G_Normalize(OGRGeometryH hGeom) -> OGRGeometryH

Attempts to bring geometry into normalized/canonical form.

Parameters

  • hGeom: The Geometry to normalize.

Returns

a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_overlapsMethod
OGR_G_Overlaps(OGRGeometryH hThis,
               OGRGeometryH hOther) -> int

Test for overlap.

Parameters

  • hThis: the geometry to compare.
  • hOther: the other geometry to compare.

Returns

TRUE if they are overlapping, otherwise FALSE.

GDAL.ogr_g_pointonsurfaceMethod
OGR_G_PointOnSurface(OGRGeometryH hGeom) -> OGRGeometryH

Returns a point guaranteed to lie on the surface.

Parameters

  • hGeom: the geometry to operate on.

Returns

a point guaranteed to lie on the surface or NULL if an error occurred.

GDAL.ogr_g_polygonizeMethod
OGR_G_Polygonize(OGRGeometryH hTarget) -> OGRGeometryH

Polygonizes a set of sparse edges.

Parameters

  • hTarget: The Geometry to be polygonized.

Returns

a handle to a newly allocated geometry now owned by the caller, or NULL on failure.

GDAL.ogr_g_removegeometryMethod
OGR_G_RemoveGeometry(OGRGeometryH hGeom,
                     int iGeom,
                     int bDelete) -> OGRErr

Remove a geometry from an exiting geometry container.

Parameters

  • hGeom: the existing geometry to delete from.
  • iGeom: the index of the geometry to delete. A value of -1 is a special flag meaning that all geometries should be removed.
  • bDelete: if TRUE the geometry will be destroyed, otherwise it will not. The default is TRUE as the existing geometry is considered to own the geometries in it.

Returns

OGRERRNONE if successful, or OGRERRFAILURE if the index is out of range.

GDAL.ogr_g_removelowerdimensionsubgeomsMethod
OGR_G_RemoveLowerDimensionSubGeoms(const OGRGeometryH hGeom) -> OGRGeometryH

Remove sub-geometries from a geometry collection that do not have the maximum topological dimensionality of the collection.

Parameters

  • hGeom: handle to the geometry to convert

Returns

a new geometry.

GDAL.ogr_g_segmentizeMethod
OGR_G_Segmentize(OGRGeometryH hGeom,
                 double dfMaxLength) -> void

Modify the geometry such it has no segment longer then the given distance.

Parameters

  • hGeom: handle on the geometry to segmentize
  • dfMaxLength: the maximum distance between 2 points after segmentization
GDAL.ogr_g_set3dMethod
OGR_G_Set3D(OGRGeometryH hGeom,
            int bIs3D) -> void

Add or remove the Z coordinate dimension.

Parameters

  • hGeom: handle on the geometry to set or unset the Z dimension.
  • bIs3D: Should the geometry have a Z dimension, either TRUE or FALSE.
GDAL.ogr_g_setcoordinatedimensionMethod
OGR_G_SetCoordinateDimension(OGRGeometryH hGeom,
                             int nNewDimension) -> void

Set the coordinate dimension.

Parameters

  • hGeom: handle on the geometry to set the dimension of the coordinates.
  • nNewDimension: New coordinate dimension value, either 2 or 3.
GDAL.ogr_g_setmeasuredMethod
OGR_G_SetMeasured(OGRGeometryH hGeom,
                  int bIsMeasured) -> void

Add or remove the M coordinate dimension.

Parameters

  • hGeom: handle on the geometry to set or unset the M dimension.
  • bIsMeasured: Should the geometry have a M dimension, either TRUE or FALSE.
GDAL.ogr_g_setpointMethod
OGR_G_SetPoint(OGRGeometryH hGeom,
               int i,
               double dfX,
               double dfY,
               double dfZ) -> void

Set the location of a vertex in a point or linestring geometry.

Parameters

  • hGeom: handle to the geometry to add a vertex to.
  • i: the index of the vertex to assign (zero based) or zero for a point.
  • dfX: input X coordinate to assign.
  • dfY: input Y coordinate to assign.
  • dfZ: input Z coordinate to assign (defaults to zero).
GDAL.ogr_g_setpoint_2dMethod
OGR_G_SetPoint_2D(OGRGeometryH hGeom,
                  int i,
                  double dfX,
                  double dfY) -> void

Set the location of a vertex in a point or linestring geometry.

Parameters

  • hGeom: handle to the geometry to add a vertex to.
  • i: the index of the vertex to assign (zero based) or zero for a point.
  • dfX: input X coordinate to assign.
  • dfY: input Y coordinate to assign.
GDAL.ogr_g_setpointcountMethod
OGR_G_SetPointCount(OGRGeometryH hGeom,
                    int nNewPointCount) -> void

Set number of points in a geometry.

Parameters

  • hGeom: handle to the geometry.
  • nNewPointCount: the new number of points for geometry.
GDAL.ogr_g_setpointmMethod
OGR_G_SetPointM(OGRGeometryH hGeom,
                int i,
                double dfX,
                double dfY,
                double dfM) -> void

Set the location of a vertex in a point or linestring geometry.

Parameters

  • hGeom: handle to the geometry to add a vertex to.
  • i: the index of the vertex to assign (zero based) or zero for a point.
  • dfX: input X coordinate to assign.
  • dfY: input Y coordinate to assign.
  • dfM: input M coordinate to assign.
GDAL.ogr_g_setpointsMethod
OGR_G_SetPoints(OGRGeometryH hGeom,
                int nPointsIn,
                const void * pabyX,
                int nXStride,
                const void * pabyY,
                int nYStride,
                const void * pabyZ,
                int nZStride) -> void

Assign all points in a point or a line string geometry.

Parameters

  • hGeom: handle to the geometry to set the coordinates.
  • nPointsIn: number of points being passed in padfX and padfY.
  • pabyX: list of X coordinates (double values) of points being assigned.
  • nXStride: the number of bytes between 2 elements of pabyX.
  • pabyY: list of Y coordinates (double values) of points being assigned.
  • nYStride: the number of bytes between 2 elements of pabyY.
  • pabyZ: list of Z coordinates (double values) of points being assigned (defaults to NULL for 2D objects).
  • nZStride: the number of bytes between 2 elements of pabyZ.
GDAL.ogr_g_setpointszmMethod
OGR_G_SetPointsZM(OGRGeometryH hGeom,
                  int nPointsIn,
                  const void * pX,
                  int nXStride,
                  const void * pY,
                  int nYStride,
                  const void * pZ,
                  int nZStride,
                  const void * pM,
                  int nMStride) -> void

Assign all points in a point or a line string geometry.

Parameters

  • hGeom: handle to the geometry to set the coordinates.
  • nPointsIn: number of points being passed in padfX and padfY.
  • pX: list of X coordinates (double values) of points being assigned.
  • nXStride: the number of bytes between 2 elements of pX.
  • pY: list of Y coordinates (double values) of points being assigned.
  • nYStride: the number of bytes between 2 elements of pY.
  • pZ: list of Z coordinates (double values) of points being assigned (if not NULL, upgrades the geometry to have Z coordinate).
  • nZStride: the number of bytes between 2 elements of pZ.
  • pM: list of M coordinates (double values) of points being assigned (if not NULL, upgrades the geometry to have M coordinate).
  • nMStride: the number of bytes between 2 elements of pM.
GDAL.ogr_g_setpointzmMethod
OGR_G_SetPointZM(OGRGeometryH hGeom,
                 int i,
                 double dfX,
                 double dfY,
                 double dfZ,
                 double dfM) -> void

Set the location of a vertex in a point or linestring geometry.

Parameters

  • hGeom: handle to the geometry to add a vertex to.
  • i: the index of the vertex to assign (zero based) or zero for a point.
  • dfX: input X coordinate to assign.
  • dfY: input Y coordinate to assign.
  • dfZ: input Z coordinate to assign.
  • dfM: input M coordinate to assign.
GDAL.ogr_g_simplifyMethod
OGR_G_Simplify(OGRGeometryH hThis,
               double dTolerance) -> OGRGeometryH

Compute a simplified geometry.

Parameters

  • hThis: the geometry.
  • dTolerance: the distance tolerance for the simplification.

Returns

the simplified geometry or NULL if an error occurs.

GDAL.ogr_g_simplifypreservetopologyMethod
OGR_G_SimplifyPreserveTopology(OGRGeometryH hThis,
                               double dTolerance) -> OGRGeometryH

Simplify the geometry while preserving topology.

Parameters

  • hThis: the geometry.
  • dTolerance: the distance tolerance for the simplification.

Returns

the simplified geometry or NULL if an error occurs.

GDAL.ogr_g_swapxyMethod
OGR_G_SwapXY(OGRGeometryH hGeom) -> void

Swap x and y coordinates.

Parameters

  • hGeom: geometry.
GDAL.ogr_g_symdifferenceMethod
OGR_G_SymDifference(OGRGeometryH hThis,
                    OGRGeometryH hOther) -> OGRGeometryH

Compute symmetric difference.

Parameters

  • hThis: the geometry.
  • hOther: the other geometry.

Returns

a new geometry representing the symmetric difference or NULL if the difference is empty or an error occurs.

GDAL.ogr_g_symmetricdifferenceMethod
OGR_G_SymmetricDifference(OGRGeometryH hThis,
                          OGRGeometryH hOther) -> OGRGeometryH

Compute symmetric difference (deprecated)

GDAL.ogr_g_touchesMethod
OGR_G_Touches(OGRGeometryH hThis,
              OGRGeometryH hOther) -> int

Test for touching.

Parameters

  • hThis: the geometry to compare.
  • hOther: the other geometry to compare.

Returns

TRUE if they are touching, otherwise FALSE.

GDAL.ogr_g_transformMethod
OGR_G_Transform(OGRGeometryH hGeom,
                OGRCoordinateTransformationH hTransform) -> OGRErr

Apply arbitrary coordinate transformation to geometry.

Parameters

  • hGeom: handle on the geometry to apply the transform to.
  • hTransform: handle on the transformation to apply.

Returns

OGRERR_NONE on success or an error code.

GDAL.ogr_g_transformtoMethod
OGR_G_TransformTo(OGRGeometryH hGeom,
                  OGRSpatialReferenceH hSRS) -> OGRErr

Transform geometry to new spatial reference system.

Parameters

  • hGeom: handle on the geometry to apply the transform to.
  • hSRS: handle on the spatial reference system to apply.

Returns

OGRERR_NONE on success, or an error code.

GDAL.ogr_g_unaryunionMethod
OGR_G_UnaryUnion(OGRGeometryH hThis) -> OGRGeometryH

Returns the union of all components of a single geometry.

Parameters

  • hThis: the geometry.

Returns

a new geometry representing the union or NULL if an error occurs.

GDAL.ogr_g_unionMethod
OGR_G_Union(OGRGeometryH hThis,
            OGRGeometryH hOther) -> OGRGeometryH

Compute union.

Parameters

  • hThis: the geometry.
  • hOther: the other geometry.

Returns

a new geometry representing the union or NULL if an error occurs.

GDAL.ogr_g_unioncascadedMethod
OGR_G_UnionCascaded(OGRGeometryH hThis) -> OGRGeometryH

Compute union using cascading.

Parameters

  • hThis: the geometry.

Returns

a new geometry representing the union or NULL if an error occurs.

GDAL.ogr_g_valueMethod
OGR_G_Value(OGRGeometryH hGeom,
            double dfDistance) -> OGRGeometryH

Fetch point at given distance along curve.

Parameters

  • hGeom: curve geometry.
  • dfDistance: distance along the curve at which to sample position. This distance should be between zero and get_Length() for this curve.

Returns

a point or NULL.

GDAL.ogr_g_withinMethod
OGR_G_Within(OGRGeometryH hThis,
             OGRGeometryH hOther) -> int

Test for containment.

Parameters

  • hThis: the geometry to compare.
  • hOther: the other geometry to compare.

Returns

TRUE if hThis is within hOther, otherwise FALSE.

GDAL.ogr_g_wkbsizeMethod
OGR_G_WkbSize(OGRGeometryH hGeom) -> int

Returns size of related binary representation.

Parameters

  • hGeom: handle on the geometry to get the binary size from.

Returns

size of binary representation in bytes.

GDAL.ogr_g_wkbsizeexMethod
OGR_G_WkbSizeEx(OGRGeometryH hGeom) -> size_t

Returns size of related binary representation.

Parameters

  • hGeom: handle on the geometry to get the binary size from.

Returns

size of binary representation in bytes.

GDAL.ogr_geomtransformer_createMethod
OGR_GeomTransformer_Create(OGRCoordinateTransformationH hCT,
                           CSLConstList papszOptions) -> OGRGeomTransformerH

Create a geometry transformer.

Parameters

  • hCT: Coordinate transformation object (will be cloned) or NULL.
  • papszOptions: NULL terminated list of options, or NULL. Supported options are:

WRAPDATELINE=YES

DATELINEOFFSET=longitudegapin_degree. Defaults to 10.

Returns

transformer object to free with OGRGeomTransformerDestroy()

GDAL.ogr_geomtransformer_destroyMethod
OGR_GeomTransformer_Destroy(OGRGeomTransformerH hTransformer) -> void

Destroy a geometry transformer allocated with OGRGeomTransformerCreate()

Parameters

  • hTransformer: transformer object.
GDAL.ogr_geomtransformer_transformMethod
OGR_GeomTransformer_Transform(OGRGeomTransformerH hTransformer,
                              OGRGeometryH hGeom) -> OGRGeometryH

Transforms a geometry.

Parameters

  • hTransformer: transformer object.
  • hGeom: Source geometry.

Returns

a new geometry (or NULL) to destroy with OGRGDestroyGeometry()

GDAL.ogr_getfieldsubtypenameMethod
OGR_GetFieldSubTypeName(OGRFieldSubType eSubType) -> const char *

Fetch human readable name for a field subtype.

Parameters

  • eSubType: the field subtype to get name for.

Returns

the name.

GDAL.ogr_getfieldtypenameMethod
OGR_GetFieldTypeName(OGRFieldType eType) -> const char *

Fetch human readable name for a field type.

Parameters

  • eType: the field type to get name for.

Returns

the name.

GDAL.ogr_gfld_createMethod
OGR_GFld_Create(const char * pszName,
                OGRwkbGeometryType eType) -> OGRGeomFieldDefnH

Create a new field geometry definition.

Parameters

  • pszName: the name of the new field definition.
  • eType: the type of the new field definition.

Returns

handle to the new field definition.

GDAL.ogr_gfld_destroyMethod
OGR_GFld_Destroy(OGRGeomFieldDefnH hDefn) -> void

Destroy a geometry field definition.

Parameters

  • hDefn: handle to the geometry field definition to destroy.
GDAL.ogr_gfld_getnamerefMethod
OGR_GFld_GetNameRef(OGRGeomFieldDefnH hDefn) -> const char *

Fetch name of this field.

Parameters

  • hDefn: handle to the geometry field definition.

Returns

the name of the geometry field definition.

GDAL.ogr_gfld_getspatialrefMethod
OGR_GFld_GetSpatialRef(OGRGeomFieldDefnH hDefn) -> OGRSpatialReferenceH

Fetch spatial reference system of this field.

Parameters

  • hDefn: handle to the geometry field definition

Returns

a reference to the field spatial reference system. It should not be modified.

GDAL.ogr_gfld_gettypeMethod
OGR_GFld_GetType(OGRGeomFieldDefnH hDefn) -> OGRwkbGeometryType

Fetch geometry type of this field.

Parameters

  • hDefn: handle to the geometry field definition to get type from.

Returns

field geometry type.

GDAL.ogr_gfld_isignoredMethod
OGR_GFld_IsIgnored(OGRGeomFieldDefnH hDefn) -> int

Return whether this field should be omitted when fetching features.

Parameters

  • hDefn: handle to the geometry field definition

Returns

ignore state

GDAL.ogr_gfld_isnullableMethod
OGR_GFld_IsNullable(OGRGeomFieldDefnH hDefn) -> int

Return whether this geometry field can receive null values.

Parameters

  • hDefn: handle to the field definition

Returns

TRUE if the field is authorized to be null.

GDAL.ogr_gfld_setignoredMethod
OGR_GFld_SetIgnored(OGRGeomFieldDefnH hDefn,
                    int ignore) -> void

Set whether this field should be omitted when fetching features.

Parameters

  • hDefn: handle to the geometry field definition
  • ignore: ignore state
GDAL.ogr_gfld_setnameMethod
OGR_GFld_SetName(OGRGeomFieldDefnH hDefn,
                 const char * pszName) -> void

Reset the name of this field.

Parameters

  • hDefn: handle to the geometry field definition to apply the new name to.
  • pszName: the new name to apply.
GDAL.ogr_gfld_setnullableMethod
OGR_GFld_SetNullable(OGRGeomFieldDefnH hDefn,
                     int bNullableIn) -> void

Set whether this geometry field can receive null values.

Parameters

  • hDefn: handle to the field definition
  • bNullableIn: FALSE if the field must have a not-null constraint.
GDAL.ogr_gfld_setspatialrefMethod
OGR_GFld_SetSpatialRef(OGRGeomFieldDefnH hDefn,
                       OGRSpatialReferenceH hSRS) -> void

Set the spatial reference of this field.

Parameters

  • hDefn: handle to the geometry field definition
  • hSRS: the new SRS to apply.
GDAL.ogr_gfld_settypeMethod
OGR_GFld_SetType(OGRGeomFieldDefnH hDefn,
                 OGRwkbGeometryType eType) -> void

Set the geometry type of this field.

Parameters

  • hDefn: handle to the geometry field definition to set type to.
  • eType: the new field geometry type.
GDAL.ogr_globflddomain_createMethod
OGR_GlobFldDomain_Create(const char * pszName,
                         const char * pszDescription,
                         OGRFieldType eFieldType,
                         OGRFieldSubType eFieldSubType,
                         const char * pszGlob) -> OGRFieldDomainH

Creates a new blob field domain.

Parameters

  • pszName: Domain name. Should not be NULL.
  • pszDescription: Domain description (can be NULL)
  • eFieldType: Field type.
  • eFieldSubType: Field subtype.
  • pszGlob: Glob expression. Should not be NULL.

Returns

a new handle that should be freed with OGRFldDomainDestroy()

GDAL.ogr_globflddomain_getglobMethod
OGR_GlobFldDomain_GetGlob(OGRFieldDomainH hFieldDomain) -> const char *

Get the glob expression.

Parameters

  • hFieldDomain: Field domain handle.

Returns

the glob expression, or nullptr in case of error

GDAL.ogr_gt_flattenMethod
OGR_GT_Flatten(OGRwkbGeometryType eType) -> OGRwkbGeometryType

Returns the 2D geometry type corresponding to the passed geometry type.

Parameters

  • eType: Input geometry type

Returns

2D geometry type corresponding to the passed geometry type.

GDAL.ogr_gt_getcollectionMethod
OGR_GT_GetCollection(OGRwkbGeometryType eType) -> OGRwkbGeometryType

Returns the collection type that can contain the passed geometry type.

Parameters

  • eType: Input geometry type

Returns

the collection type that can contain the passed geometry type or wkbUnknown

GDAL.ogr_gt_getcurveMethod
OGR_GT_GetCurve(OGRwkbGeometryType eType) -> OGRwkbGeometryType

Returns the curve geometry type that can contain the passed geometry type.

Parameters

  • eType: Input geometry type

Returns

the curve type that can contain the passed geometry type

GDAL.ogr_gt_getlinearMethod
OGR_GT_GetLinear(OGRwkbGeometryType eType) -> OGRwkbGeometryType

Returns the non-curve geometry type that can contain the passed geometry type.

Parameters

  • eType: Input geometry type

Returns

the non-curve type that can contain the passed geometry type

GDAL.ogr_gt_hasmMethod
OGR_GT_HasM(OGRwkbGeometryType eType) -> int

Return if the geometry type is a measured type.

Parameters

  • eType: Input geometry type

Returns

TRUE if the geometry type is a measured type.

GDAL.ogr_gt_haszMethod
OGR_GT_HasZ(OGRwkbGeometryType eType) -> int

Return if the geometry type is a 3D geometry type.

Parameters

  • eType: Input geometry type

Returns

TRUE if the geometry type is a 3D geometry type.

GDAL.ogr_gt_iscurveMethod
OGR_GT_IsCurve(OGRwkbGeometryType eGeomType) -> int

Return if a geometry type is an instance of Curve.

Parameters

  • eGeomType: the geometry type

Returns

TRUE if the geometry type is an instance of Curve

GDAL.ogr_gt_isnonlinearMethod
OGR_GT_IsNonLinear(OGRwkbGeometryType eGeomType) -> int

Return if a geometry type is a non-linear geometry type.

Parameters

  • eGeomType: the geometry type

Returns

TRUE if the geometry type is a non-linear geometry type.

GDAL.ogr_gt_issubclassofMethod
OGR_GT_IsSubClassOf(OGRwkbGeometryType eType,
                    OGRwkbGeometryType eSuperType) -> int

Returns if a type is a subclass of another one.

Parameters

  • eType: Type.
  • eSuperType: Super type

Returns

TRUE if eType is a subclass of eSuperType.

GDAL.ogr_gt_issurfaceMethod
OGR_GT_IsSurface(OGRwkbGeometryType eGeomType) -> int

Return if a geometry type is an instance of Surface.

Parameters

  • eGeomType: the geometry type

Returns

TRUE if the geometry type is an instance of Surface

GDAL.ogr_gt_setmMethod
OGR_GT_SetM(OGRwkbGeometryType eType) -> OGRwkbGeometryType

Returns the measured geometry type corresponding to the passed geometry type.

Parameters

  • eType: Input geometry type

Returns

measured geometry type corresponding to the passed geometry type.

GDAL.ogr_gt_setmodifierMethod
OGR_GT_SetModifier(OGRwkbGeometryType eType,
                   int bHasZ,
                   int bHasM) -> OGRwkbGeometryType

Returns a XY, XYZ, XYM or XYZM geometry type depending on parameter.

Parameters

  • eType: Input geometry type
  • bHasZ: TRUE if the output geometry type must be 3D.
  • bHasM: TRUE if the output geometry type must be measured.

Returns

Output geometry type.

GDAL.ogr_gt_setzMethod
OGR_GT_SetZ(OGRwkbGeometryType eType) -> OGRwkbGeometryType

Returns the 3D geometry type corresponding to the passed geometry type.

Parameters

  • eType: Input geometry type

Returns

3D geometry type corresponding to the passed geometry type.

GDAL.ogr_l_alterfielddefnMethod
OGR_L_AlterFieldDefn(OGRLayerH hLayer,
                     int iField,
                     OGRFieldDefnH hNewFieldDefn,
                     int nFlags) -> OGRErr

Alter the definition of an existing field on a layer.

Parameters

  • hLayer: handle to the layer.
  • iField: index of the field whose definition must be altered.
  • hNewFieldDefn: new field definition
  • nFlags: combination of ALTERNAMEFLAG, ALTERTYPEFLAG, ALTERWIDTHPRECISIONFLAG, ALTERNULLABLEFLAG and ALTERDEFAULT_FLAG to indicate which of the name and/or type and/or width and precision fields and/or nullability from the new field definition must be taken into account.

Returns

OGRERR_NONE on success.

GDAL.ogr_l_altergeomfielddefnMethod
OGR_L_AlterGeomFieldDefn(OGRLayerH hLayer,
                         int iField,
                         OGRGeomFieldDefnH hNewGeomFieldDefn,
                         int nFlags) -> OGRErr

Alter the definition of an existing geometry field on a layer.

Parameters

  • hLayer: handle to the layer.
  • iGeomField: index of the field whose definition must be altered.
  • hNewGeomFieldDefn: new field definition
  • nFlags: combination of ALTERGEOMFIELDDEFNNAMEFLAG, ALTERGEOMFIELDDEFNTYPEFLAG, ALTERGEOMFIELDDEFNNULLABLEFLAG, ALTERGEOMFIELDDEFNSRSFLAG, ALTERGEOMFIELDDEFNSRSCOORDEPOCHFLAG to indicate which of the name and/or type and/or nullability and/or SRS and/or coordinate epoch from the new field definition must be taken into account. Or ALTERGEOMFIELDDEFNALLFLAG to update all members.

Returns

OGRERR_NONE on success.

GDAL.ogr_l_clipMethod
OGR_L_Clip(OGRLayerH pLayerInput,
           OGRLayerH pLayerMethod,
           OGRLayerH pLayerResult,
           char ** papszOptions,
           GDALProgressFunc pfnProgress,
           void * pProgressArg) -> OGRErr

Clip off areas that are not covered by the method layer.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_committransactionMethod
OGR_L_CommitTransaction(OGRLayerH hLayer) -> OGRErr

For datasources which support transactions, CommitTransaction commits a transaction.

Parameters

  • hLayer: handle to the layer

Returns

OGRERR_NONE on success.

GDAL.ogr_l_createfeatureMethod
OGR_L_CreateFeature(OGRLayerH hLayer,
                    OGRFeatureH hFeat) -> OGRErr

Create and write a new feature within a layer.

Parameters

  • hLayer: handle to the layer to write the feature to.
  • hFeat: the handle of the feature to write to disk.

Returns

OGRERR_NONE on success.

GDAL.ogr_l_createfieldMethod
OGR_L_CreateField(OGRLayerH hLayer,
                  OGRFieldDefnH hField,
                  int bApproxOK) -> OGRErr

Create a new field on a layer.

Parameters

  • hLayer: handle to the layer to write the field definition.
  • hField: handle of the field definition to write to disk.
  • bApproxOK: If TRUE, the field may be created in a slightly different form depending on the limitations of the format driver.

Returns

OGRERR_NONE on success.

GDAL.ogr_l_creategeomfieldMethod
OGR_L_CreateGeomField(OGRLayerH hLayer,
                      OGRGeomFieldDefnH hFieldDefn,
                      int bForce) -> OGRErr

Create a new geometry field on a layer.

Parameters

  • hLayer: handle to the layer to write the field definition.
  • hField: handle of the geometry field definition to write to disk.
  • bApproxOK: If TRUE, the field may be created in a slightly different form depending on the limitations of the format driver.

Returns

OGRERR_NONE on success.

GDAL.ogr_l_deletefeatureMethod
OGR_L_DeleteFeature(OGRLayerH hLayer,
                    GIntBig nFID) -> OGRErr

Delete feature from layer.

Parameters

  • hLayer: handle to the layer
  • nFID: the feature id to be deleted from the layer

Returns

OGRERRNONE if the operation works, otherwise an appropriate error code (e.g OGRERRNONEXISTINGFEATURE if the feature does not exist).

GDAL.ogr_l_deletefieldMethod
OGR_L_DeleteField(OGRLayerH hLayer,
                  int iField) -> OGRErr

Delete an existing field on a layer.

Parameters

  • hLayer: handle to the layer.
  • iField: index of the field to delete.

Returns

OGRERR_NONE on success.

GDAL.ogr_l_eraseMethod
OGR_L_Erase(OGRLayerH pLayerInput,
            OGRLayerH pLayerMethod,
            OGRLayerH pLayerResult,
            char ** papszOptions,
            GDALProgressFunc pfnProgress,
            void * pProgressArg) -> OGRErr

Remove areas that are covered by the method layer.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_findfieldindexMethod
OGR_L_FindFieldIndex(OGRLayerH hLayer,
                     const char * pszFieldName,
                     int bExactMatch) -> int

Find the index of field in a layer.

Returns

field index, or -1 if the field doesn't exist

GDAL.ogr_l_getarrowstreamMethod
OGR_L_GetArrowStream(OGRLayerH hLayer,
                     struct ArrowArrayStream * out_stream,
                     char ** papszOptions) -> bool

Get a Arrow C stream.

Parameters

  • hLayer: Layer
  • out_stream: Output stream. Must not be NULL. The content of the structure does not need to be initialized.
  • papszOptions: NULL terminated list of key=value options.

Returns

true in case of success.

GDAL.ogr_l_getextentMethod
OGR_L_GetExtent(OGRLayerH hLayer,
                OGREnvelope * psExtent,
                int bForce) -> OGRErr

Fetch the extent of this layer.

Parameters

  • hLayer: handle to the layer from which to get extent.
  • psExtent: the structure in which the extent value will be returned.
  • bForce: Flag indicating whether the extent should be computed even if it is expensive.

Returns

OGRERRNONE on success, OGRERRFAILURE if extent not known.

GDAL.ogr_l_getextentexMethod
OGR_L_GetExtentEx(OGRLayerH hLayer,
                  int iGeomField,
                  OGREnvelope * psExtent,
                  int bForce) -> OGRErr

Fetch the extent of this layer, on the specified geometry field.

Parameters

  • hLayer: handle to the layer from which to get extent.
  • iGeomField: the index of the geometry field on which to compute the extent.
  • psExtent: the structure in which the extent value will be returned.
  • bForce: Flag indicating whether the extent should be computed even if it is expensive.

Returns

OGRERRNONE on success, OGRERRFAILURE if extent not known.

GDAL.ogr_l_getfeatureMethod
OGR_L_GetFeature(OGRLayerH hLayer,
                 GIntBig nFeatureId) -> OGRFeatureH

Fetch a feature by its identifier.

Parameters

  • hLayer: handle to the layer that owned the feature.
  • nFeatureId: the feature id of the feature to read.

Returns

a handle to a feature now owned by the caller, or NULL on failure.

GDAL.ogr_l_getfeaturecountMethod
OGR_L_GetFeatureCount(OGRLayerH hLayer,
                      int bForce) -> GIntBig

Fetch the feature count in this layer.

Parameters

  • hLayer: handle to the layer that owned the features.
  • bForce: Flag indicating whether the count should be computed even if it is expensive.

Returns

feature count, -1 if count not known.

GDAL.ogr_l_getgeometrycolumnMethod
OGR_L_GetGeometryColumn(OGRLayerH hLayer) -> const char *

This method returns the name of the underlying database column being used as the geometry column, or "" if not supported.

Parameters

  • hLayer: handle to the layer

Returns

geometry column name.

GDAL.ogr_l_getgeometrytypesMethod
OGR_L_GetGeometryTypes(OGRLayerH hLayer,
                       int iGeomField,
                       int nFlags,
                       int * pnEntryCount,
                       GDALProgressFunc pfnProgress,
                       void * pProgressData) -> OGRGeometryTypeCounter *

Get actual geometry types found in features.

Parameters

  • hLayer: Layer.
  • iGeomField: Geometry field index.
  • nFlags: Hint flags. 0, or combination of OGRGGTCOUNTNOTNEEDED, OGRGGTSTOPIFMIXED, OGRGGTGEOMCOLLECTIONZ_TINZ
  • pnEntryCount: Pointer to the number of entries in the returned array. Must not be NULL.
  • pfnProgress: Cancellation callback. May be NULL.
  • pProgressData: User data for the cancellation callback. May be NULL.

Returns

an array of *pnEntryCount that must be freed with CPLFree(), or NULL in case of error

GDAL.ogr_l_getgeomtypeMethod
OGR_L_GetGeomType(OGRLayerH hLayer) -> OGRwkbGeometryType

Return the layer geometry type.

Parameters

  • hLayer: handle to the layer.

Returns

the geometry type

GDAL.ogr_l_getlayerdefnMethod
OGR_L_GetLayerDefn(OGRLayerH hLayer) -> OGRFeatureDefnH

Fetch the schema information for this layer.

Parameters

  • hLayer: handle to the layer to get the schema information.

Returns

a handle to the feature definition.

GDAL.ogr_l_getnameMethod
OGR_L_GetName(OGRLayerH hLayer) -> const char *

Return the layer name.

Parameters

  • hLayer: handle to the layer.

Returns

the layer name (must not been freed)

GDAL.ogr_l_getnextfeatureMethod
OGR_L_GetNextFeature(OGRLayerH hLayer) -> OGRFeatureH

Fetch the next available feature from this layer.

Parameters

  • hLayer: handle to the layer from which feature are read.

Returns

a handle to a feature, or NULL if no more features are available.

GDAL.ogr_l_getspatialfilterMethod
OGR_L_GetSpatialFilter(OGRLayerH hLayer) -> OGRGeometryH

This function returns the current spatial filter for this layer.

Parameters

  • hLayer: handle to the layer to get the spatial filter from.

Returns

a handle to the spatial filter geometry.

GDAL.ogr_l_getspatialrefMethod
OGR_L_GetSpatialRef(OGRLayerH hLayer) -> OGRSpatialReferenceH

Fetch the spatial reference system for this layer.

Parameters

  • hLayer: handle to the layer to get the spatial reference from.

Returns

spatial reference, or NULL if there isn't one.

GDAL.ogr_l_getsupportedsrslistMethod
OGR_L_GetSupportedSRSList(OGRLayerH hLayer,
                          int iGeomField,
                          int * pnCount) -> OGRSpatialReferenceH *

Get the list of SRS supported.

Parameters

  • hLayer: Layer.
  • iGeomField: Geometry field index.
  • pnCount: Number of values in returned array. Must not be null.

Returns

list of supported SRS, to be freeds with OSRFreeSRSArray(), or nullptr

GDAL.ogr_l_identityMethod
OGR_L_Identity(OGRLayerH pLayerInput,
               OGRLayerH pLayerMethod,
               OGRLayerH pLayerResult,
               char ** papszOptions,
               GDALProgressFunc pfnProgress,
               void * pProgressArg) -> OGRErr

Identify the features of this layer with the ones from the identity layer.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_intersectionMethod
OGR_L_Intersection(OGRLayerH pLayerInput,
                   OGRLayerH pLayerMethod,
                   OGRLayerH pLayerResult,
                   char ** papszOptions,
                   GDALProgressFunc pfnProgress,
                   void * pProgressArg) -> OGRErr

Intersection of two layers.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_renameMethod
OGR_L_Rename(OGRLayerH hLayer,
             const char * pszNewName) -> OGRErr

Rename layer.

Parameters

  • hLayer: Layer to rename.
  • pszNewName: New layer name. Must not be NULL.

Returns

OGRERR_NONE in case of success

GDAL.ogr_l_reorderfieldMethod
OGR_L_ReorderField(OGRLayerH hLayer,
                   int iOldFieldPos,
                   int iNewFieldPos) -> OGRErr

Reorder an existing field on a layer.

Parameters

  • hLayer: handle to the layer.
  • iOldFieldPos: previous position of the field to move. Must be in the range [0,GetFieldCount()-1].
  • iNewFieldPos: new position of the field to move. Must be in the range [0,GetFieldCount()-1].

Returns

OGRERR_NONE on success.

GDAL.ogr_l_reorderfieldsMethod
OGR_L_ReorderFields(OGRLayerH hLayer,
                    int * panMap) -> OGRErr

Reorder all the fields of a layer.

Parameters

  • hLayer: handle to the layer.
  • panMap: an array of GetLayerDefn()->OGRFeatureDefn::GetFieldCount() elements which is a permutation of [0, GetLayerDefn()->OGRFeatureDefn::GetFieldCount()-1].

Returns

OGRERR_NONE on success.

GDAL.ogr_l_resetreadingMethod
OGR_L_ResetReading(OGRLayerH hLayer) -> void

Reset feature reading to start on the first feature.

Parameters

  • hLayer: handle to the layer on which features are read.
GDAL.ogr_l_rollbacktransactionMethod
OGR_L_RollbackTransaction(OGRLayerH hLayer) -> OGRErr

For datasources which support transactions, RollbackTransaction will roll back a datasource to its state before the start of the current transaction.

Parameters

  • hLayer: handle to the layer

Returns

OGRERR_NONE on success.

GDAL.ogr_l_setactivesrsMethod
OGR_L_SetActiveSRS(OGRLayerH hLayer,
                   int iGeomField,
                   OGRSpatialReferenceH hSRS) -> OGRErr

Change the active SRS.

Parameters

  • hLayer: Layer.
  • iGeomField: Geometry field index.
  • hSRS: SRS to use

Returns

OGRERRNONE in case of success, OGRERRFAILURE if the passed SRS is not in GetSupportedSRSList().

GDAL.ogr_l_setattributefilterMethod
OGR_L_SetAttributeFilter(OGRLayerH hLayer,
                         const char * pszQuery) -> OGRErr

Set a new attribute query.

Parameters

  • hLayer: handle to the layer on which attribute query will be executed.
  • pszQuery: query in restricted SQL WHERE format, or NULL to clear the current query.

Returns

OGRERR_NONE if successfully installed, or an error code if the query expression is in error, or some other failure occurs.

GDAL.ogr_l_setfeatureMethod
OGR_L_SetFeature(OGRLayerH hLayer,
                 OGRFeatureH hFeat) -> OGRErr

Rewrite/replace an existing feature.

Parameters

  • hLayer: handle to the layer to write the feature.
  • hFeat: the feature to write.

Returns

OGRERRNONE if the operation works, otherwise an appropriate error code (e.g OGRERRNONEXISTINGFEATURE if the feature does not exist).

GDAL.ogr_l_setignoredfieldsMethod
OGR_L_SetIgnoredFields(OGRLayerH hLayer,
                       const char ** papszFields) -> OGRErr

Set which fields can be omitted when retrieving features from the layer.

Parameters

  • hLayer: handle to the layer
  • papszFields: an array of field names terminated by NULL item. If NULL is passed, the ignored list is cleared.

Returns

OGRERR_NONE if all field names have been resolved (even if the driver does not support this method)

GDAL.ogr_l_setnextbyindexMethod
OGR_L_SetNextByIndex(OGRLayerH hLayer,
                     GIntBig nIndex) -> OGRErr

Move read cursor to the nIndex'th feature in the current resultset.

Parameters

  • hLayer: handle to the layer
  • nIndex: the index indicating how many steps into the result set to seek.

Returns

OGRERR_NONE on success or an error code.

GDAL.ogr_l_setspatialfilterMethod
OGR_L_SetSpatialFilter(OGRLayerH hLayer,
                       OGRGeometryH hGeom) -> void

Set a new spatial filter.

Parameters

  • hLayer: handle to the layer on which to set the spatial filter.
  • hGeom: handle to the geometry to use as a filtering region. NULL may be passed indicating that the current spatial filter should be cleared, but no new one instituted.
GDAL.ogr_l_setspatialfilterexMethod
OGR_L_SetSpatialFilterEx(OGRLayerH hLayer,
                         int iGeomField,
                         OGRGeometryH hGeom) -> void

Set a new spatial filter.

Parameters

  • hLayer: handle to the layer on which to set the spatial filter.
  • iGeomField: index of the geometry field on which the spatial filter operates.
  • hGeom: handle to the geometry to use as a filtering region. NULL may be passed indicating that the current spatial filter should be cleared, but no new one instituted.
GDAL.ogr_l_setspatialfilterrectMethod
OGR_L_SetSpatialFilterRect(OGRLayerH hLayer,
                           double dfMinX,
                           double dfMinY,
                           double dfMaxX,
                           double dfMaxY) -> void

Set a new rectangular spatial filter.

Parameters

  • hLayer: handle to the layer on which to set the spatial filter.
  • dfMinX: the minimum X coordinate for the rectangular region.
  • dfMinY: the minimum Y coordinate for the rectangular region.
  • dfMaxX: the maximum X coordinate for the rectangular region.
  • dfMaxY: the maximum Y coordinate for the rectangular region.
GDAL.ogr_l_setspatialfilterrectexMethod
OGR_L_SetSpatialFilterRectEx(OGRLayerH hLayer,
                             int iGeomField,
                             double dfMinX,
                             double dfMinY,
                             double dfMaxX,
                             double dfMaxY) -> void

Set a new rectangular spatial filter.

Parameters

  • hLayer: handle to the layer on which to set the spatial filter.
  • iGeomField: index of the geometry field on which the spatial filter operates.
  • dfMinX: the minimum X coordinate for the rectangular region.
  • dfMinY: the minimum Y coordinate for the rectangular region.
  • dfMaxX: the maximum X coordinate for the rectangular region.
  • dfMaxY: the maximum Y coordinate for the rectangular region.
GDAL.ogr_l_starttransactionMethod
OGR_L_StartTransaction(OGRLayerH hLayer) -> OGRErr

For datasources which support transactions, StartTransaction creates a transaction.

Parameters

  • hLayer: handle to the layer

Returns

OGRERR_NONE on success.

GDAL.ogr_l_symdifferenceMethod
OGR_L_SymDifference(OGRLayerH pLayerInput,
                    OGRLayerH pLayerMethod,
                    OGRLayerH pLayerResult,
                    char ** papszOptions,
                    GDALProgressFunc pfnProgress,
                    void * pProgressArg) -> OGRErr

Symmetrical difference of two layers.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_testcapabilityMethod
OGR_L_TestCapability(OGRLayerH hLayer,
                     const char * pszCap) -> int

Test if this layer supported the named capability.

Parameters

  • hLayer: handle to the layer to get the capability from.
  • pszCap: the name of the capability to test.

Returns

TRUE if the layer has the requested capability, or FALSE otherwise. OGRLayers will return FALSE for any unrecognized capabilities.

GDAL.ogr_l_unionMethod
OGR_L_Union(OGRLayerH pLayerInput,
            OGRLayerH pLayerMethod,
            OGRLayerH pLayerResult,
            char ** papszOptions,
            GDALProgressFunc pfnProgress,
            void * pProgressArg) -> OGRErr

Union of two layers.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_updateMethod
OGR_L_Update(OGRLayerH pLayerInput,
             OGRLayerH pLayerMethod,
             OGRLayerH pLayerResult,
             char ** papszOptions,
             GDALProgressFunc pfnProgress,
             void * pProgressArg) -> OGRErr

Update this layer with features from the update layer.

Parameters

  • pLayerInput: the input layer. Should not be NULL.
  • pLayerMethod: the method layer. Should not be NULL.
  • pLayerResult: the layer where the features resulting from the operation are inserted. Should not be NULL. See above the note about the schema.
  • papszOptions: NULL terminated list of options (may be NULL).
  • pfnProgress: a GDALProgressFunc() compatible callback function for reporting progress or NULL.
  • pProgressArg: argument to be passed to pfnProgress. May be NULL.

Returns

an error code if there was an error or the execution was interrupted, OGRERR_NONE otherwise.

GDAL.ogr_l_updatefeatureMethod
OGR_L_UpdateFeature(OGRLayerH hLayer,
                    OGRFeatureH hFeat,
                    int nUpdatedFieldsCount,
                    const int * panUpdatedFieldsIdx,
                    int nUpdatedGeomFieldsCount,
                    const int * panUpdatedGeomFieldsIdx,
                    bool bUpdateStyleString) -> OGRErr

Update (part of) an existing feature.

Parameters

  • hLayer: handle to the layer to write the feature.
  • hFeat: the feature to update.
  • nUpdatedFieldsCount: number of attribute fields to update. May be 0
  • panUpdatedFieldsIdx: array of nUpdatedFieldsCount values, each between 0 and GetLayerDefn()->GetFieldCount() - 1, indicating which fields of hFeat must be updated in the layer.
  • nUpdatedGeomFieldsCount: number of geometry fields to update. May be 0
  • panUpdatedGeomFieldsIdx: array of nUpdatedGeomFieldsCount values, each between 0 and GetLayerDefn()->GetGeomFieldCount() - 1, indicating which geometry fields of hFeat must be updated in the layer.
  • bUpdateStyleString: whether the feature style string in the layer should be updated with the one of hFeat.

Returns

OGRERRNONE if the operation works, otherwise an appropriate error code (e.g OGRERRNONEXISTINGFEATURE if the feature does not exist).

GDAL.ogr_l_upsertfeatureMethod
OGR_L_UpsertFeature(OGRLayerH hLayer,
                    OGRFeatureH hFeat) -> OGRErr

Rewrite/replace an existing feature or create a new feature within a layer.

Parameters

  • hLayer: handle to the layer to write the feature to.
  • hFeat: the handle of the feature to write to disk.

Returns

OGRERR_NONE on success.

GDAL.ogr_rangeflddomain_createMethod
OGR_RangeFldDomain_Create(const char * pszName,
                          const char * pszDescription,
                          OGRFieldType eFieldType,
                          OGRFieldSubType eFieldSubType,
                          const OGRField * psMin,
                          bool bMinIsInclusive,
                          const OGRField * psMax,
                          bool bMaxIsInclusive) -> OGRFieldDomainH

Creates a new range field domain.

Parameters

  • pszName: Domain name. Should not be NULL.
  • pszDescription: Domain description (can be NULL)
  • eFieldType: Field type. Among OFTInteger, OFTInteger64, OFTReal and OFTDateTime.
  • eFieldSubType: Field subtype.
  • psMin: Minimum value (can be NULL). The member in the union that is read is consistent with eFieldType
  • bMinIsInclusive: Whether the minimum value is included in the range.
  • psMax: Maximum value (can be NULL). The member in the union that is read is consistent with eFieldType
  • bMaxIsInclusive: Whether the maximum value is included in the range.

Returns

a new handle that should be freed with OGRFldDomainDestroy()

GDAL.ogr_rangeflddomain_getmaxMethod
OGR_RangeFldDomain_GetMax(OGRFieldDomainH hFieldDomain,
                          bool * pbIsInclusiveOut) -> const OGRField *

Get the maximum value.

Parameters

  • hFieldDomain: Field domain handle.
  • pbIsInclusiveOut: set to true if the maximum is included in the range.

Returns

the maximum value.

GDAL.ogr_rangeflddomain_getminMethod
OGR_RangeFldDomain_GetMin(OGRFieldDomainH hFieldDomain,
                          bool * pbIsInclusiveOut) -> const OGRField *

Get the minimum value.

Parameters

  • hFieldDomain: Field domain handle.
  • pbIsInclusiveOut: set to true if the minimum is included in the range.

Returns

the minimum value.

GDAL.ogr_rawfield_isnullMethod
OGR_RawField_IsNull(const OGRField * puField) -> int

Returns whether a raw field is null.

Parameters

  • puField: pointer to raw field.
GDAL.ogr_rawfield_isunsetMethod
OGR_RawField_IsUnset(const OGRField * puField) -> int

Returns whether a raw field is unset.

Parameters

  • puField: pointer to raw field.
GDAL.ogr_rawfield_setnullMethod
OGR_RawField_SetNull(OGRField * puField) -> void

Mark a raw field as null.

Parameters

  • puField: pointer to raw field.
GDAL.ogr_rawfield_setunsetMethod
OGR_RawField_SetUnset(OGRField * puField) -> void

Mark a raw field as unset.

Parameters

  • puField: pointer to raw field.
GDAL.ogr_sm_addpartMethod
OGR_SM_AddPart(OGRStyleMgrH hSM,
               OGRStyleToolH hST) -> int

Add a part (style tool) to the current style.

Parameters

  • hSM: handle to the style manager.
  • hST: the style tool defining the part to add.

Returns

TRUE on success, FALSE on errors.

GDAL.ogr_sm_addstyleMethod
OGR_SM_AddStyle(OGRStyleMgrH hSM,
                const char * pszStyleName,
                const char * pszStyleString) -> int

Add a style to the current style table.

Parameters

  • hSM: handle to the style manager.
  • pszStyleName: the name of the style to add.
  • pszStyleString: the style string to use, or NULL to use the style stored in the manager.

Returns

TRUE on success, FALSE on errors.

GDAL.ogr_sm_createMethod
OGR_SM_Create(OGRStyleTableH hStyleTable) -> OGRStyleMgrH

OGRStyleMgr factory.

Parameters

  • hStyleTable: pointer to OGRStyleTable or NULL if not working with a style table.

Returns

a handle to the new style manager object.

GDAL.ogr_sm_destroyMethod
OGR_SM_Destroy(OGRStyleMgrH hSM) -> void

Destroy Style Manager.

Parameters

  • hSM: handle to the style manager to destroy.
GDAL.ogr_sm_getpartMethod
OGR_SM_GetPart(OGRStyleMgrH hSM,
               int nPartId,
               const char * pszStyleString) -> OGRStyleToolH

Fetch a part (style tool) from the current style.

Parameters

  • hSM: handle to the style manager.
  • nPartId: the part number (0-based index).
  • pszStyleString: (optional) the style string on which to operate. If NULL then the current style string stored in the style manager is used.

Returns

OGRStyleToolH of the requested part (style tools) or NULL on error.

GDAL.ogr_sm_getpartcountMethod
OGR_SM_GetPartCount(OGRStyleMgrH hSM,
                    const char * pszStyleString) -> int

Get the number of parts in a style.

Parameters

  • hSM: handle to the style manager.
  • pszStyleString: (optional) the style string on which to operate. If NULL then the current style string stored in the style manager is used.

Returns

the number of parts (style tools) in the style.

GDAL.ogr_sm_initfromfeatureMethod
OGR_SM_InitFromFeature(OGRStyleMgrH hSM,
                       OGRFeatureH hFeat) -> const char *

Initialize style manager from the style string of a feature.

Parameters

  • hSM: handle to the style manager.
  • hFeat: handle to the new feature from which to read the style.

Returns

a reference to the style string read from the feature, or NULL in case of error.

GDAL.ogr_sm_initstylestringMethod
OGR_SM_InitStyleString(OGRStyleMgrH hSM,
                       const char * pszStyleString) -> int

Initialize style manager from the style string.

Parameters

  • hSM: handle to the style manager.
  • pszStyleString: the style string to use (can be NULL).

Returns

TRUE on success, FALSE on errors.

GDAL.ogr_st_createMethod
OGR_ST_Create(OGRSTClassId eClassId) -> OGRStyleToolH

OGRStyleTool factory.

Parameters

  • eClassId: subclass of style tool to create. One of OGRSTCPen (1), OGRSTCBrush (2), OGRSTCSymbol (3) or OGRSTCLabel (4).

Returns

a handle to the new style tool object or NULL if the creation failed.

GDAL.ogr_st_destroyMethod
OGR_ST_Destroy(OGRStyleToolH hST) -> void

Destroy Style Tool.

Parameters

  • hST: handle to the style tool to destroy.
GDAL.ogr_st_getparamdblMethod
OGR_ST_GetParamDbl(OGRStyleToolH hST,
                   int eParam,
                   int * bValueIsNull) -> double

Get Style Tool parameter value as a double.

Parameters

  • hST: handle to the style tool.
  • eParam: the parameter id from the enumeration corresponding to the type of this style tool (one of the OGRSTPenParam, OGRSTBrushParam, OGRSTSymbolParam or OGRSTLabelParam enumerations)
  • bValueIsNull: pointer to an integer that will be set to TRUE or FALSE to indicate whether the parameter value is NULL.

Returns

the parameter value as double and sets bValueIsNull.

GDAL.ogr_st_getparamnumMethod
OGR_ST_GetParamNum(OGRStyleToolH hST,
                   int eParam,
                   int * bValueIsNull) -> int

Get Style Tool parameter value as an integer.

Parameters

  • hST: handle to the style tool.
  • eParam: the parameter id from the enumeration corresponding to the type of this style tool (one of the OGRSTPenParam, OGRSTBrushParam, OGRSTSymbolParam or OGRSTLabelParam enumerations)
  • bValueIsNull: pointer to an integer that will be set to TRUE or FALSE to indicate whether the parameter value is NULL.

Returns

the parameter value as integer and sets bValueIsNull.

GDAL.ogr_st_getparamstrMethod
OGR_ST_GetParamStr(OGRStyleToolH hST,
                   int eParam,
                   int * bValueIsNull) -> const char *

Get Style Tool parameter value as string.

Parameters

  • hST: handle to the style tool.
  • eParam: the parameter id from the enumeration corresponding to the type of this style tool (one of the OGRSTPenParam, OGRSTBrushParam, OGRSTSymbolParam or OGRSTLabelParam enumerations)
  • bValueIsNull: pointer to an integer that will be set to TRUE or FALSE to indicate whether the parameter value is NULL.

Returns

the parameter value as string and sets bValueIsNull.

GDAL.ogr_st_getrgbfromstringMethod
OGR_ST_GetRGBFromString(OGRStyleToolH hST,
                        const char * pszColor,
                        int * pnRed,
                        int * pnGreen,
                        int * pnBlue,
                        int * pnAlpha) -> int

Return the r,g,b,a components of a color encoded in #RRGGBB[AA] format.

Parameters

  • hST: handle to the style tool.
  • pszColor: the color to parse
  • pnRed: pointer to an int in which the red value will be returned
  • pnGreen: pointer to an int in which the green value will be returned
  • pnBlue: pointer to an int in which the blue value will be returned
  • pnAlpha: pointer to an int in which the (optional) alpha value will be returned

Returns

TRUE if the color could be successfully parsed, or FALSE in case of errors.

GDAL.ogr_st_getstylestringMethod
OGR_ST_GetStyleString(OGRStyleToolH hST) -> const char *

Get the style string for this Style Tool.

Parameters

  • hST: handle to the style tool.

Returns

the style string for this style tool or "" if the hST is invalid.

GDAL.ogr_st_gettypeMethod
OGR_ST_GetType(OGRStyleToolH hST) -> OGRSTClassId

Determine type of Style Tool.

Parameters

  • hST: handle to the style tool.

Returns

the style tool type, one of OGRSTCPen (1), OGRSTCBrush (2), OGRSTCSymbol (3) or OGRSTCLabel (4). Returns OGRSTCNone (0) if the OGRStyleToolH is invalid.

GDAL.ogr_st_getunitMethod
OGR_ST_GetUnit(OGRStyleToolH hST) -> OGRSTUnitId

Get Style Tool units.

Parameters

  • hST: handle to the style tool.

Returns

the style tool units.

GDAL.ogr_st_setparamdblMethod
OGR_ST_SetParamDbl(OGRStyleToolH hST,
                   int eParam,
                   double dfValue) -> void

Set Style Tool parameter value from a double.

Parameters

  • hST: handle to the style tool.
  • eParam: the parameter id from the enumeration corresponding to the type of this style tool (one of the OGRSTPenParam, OGRSTBrushParam, OGRSTSymbolParam or OGRSTLabelParam enumerations)
  • dfValue: the new parameter value
GDAL.ogr_st_setparamnumMethod
OGR_ST_SetParamNum(OGRStyleToolH hST,
                   int eParam,
                   int nValue) -> void

Set Style Tool parameter value from an integer.

Parameters

  • hST: handle to the style tool.
  • eParam: the parameter id from the enumeration corresponding to the type of this style tool (one of the OGRSTPenParam, OGRSTBrushParam, OGRSTSymbolParam or OGRSTLabelParam enumerations)
  • nValue: the new parameter value
GDAL.ogr_st_setparamstrMethod
OGR_ST_SetParamStr(OGRStyleToolH hST,
                   int eParam,
                   const char * pszValue) -> void

Set Style Tool parameter value from a string.

Parameters

  • hST: handle to the style tool.
  • eParam: the parameter id from the enumeration corresponding to the type of this style tool (one of the OGRSTPenParam, OGRSTBrushParam, OGRSTSymbolParam or OGRSTLabelParam enumerations)
  • pszValue: the new parameter value
GDAL.ogr_st_setunitMethod
OGR_ST_SetUnit(OGRStyleToolH hST,
               OGRSTUnitId eUnit,
               double dfGroundPaperScale) -> void

Set Style Tool units.

Parameters

  • hST: handle to the style tool.
  • eUnit: the new unit.
  • dfGroundPaperScale: ground to paper scale factor.
GDAL.ogr_stbl_addstyleMethod
OGR_STBL_AddStyle(OGRStyleTableH hStyleTable,
                  const char * pszName,
                  const char * pszStyleString) -> int

Add a new style in the table.

Parameters

  • hStyleTable: handle to the style table.
  • pszName: the name the style to add.
  • pszStyleString: the style string to add.

Returns

TRUE on success, FALSE on error

GDAL.ogr_stbl_createMethod
OGR_STBL_Create(void) -> OGRStyleTableH

OGRStyleTable factory.

Returns

a handle to the new style table object.

GDAL.ogr_stbl_destroyMethod
OGR_STBL_Destroy(OGRStyleTableH hSTBL) -> void

Destroy Style Table.

Parameters

  • hSTBL: handle to the style table to destroy.
GDAL.ogr_stbl_findMethod
OGR_STBL_Find(OGRStyleTableH hStyleTable,
              const char * pszName) -> const char *

Get a style string by name.

Parameters

  • hStyleTable: handle to the style table.
  • pszName: the name of the style string to find.

Returns

the style string matching the name or NULL if not found or error.

GDAL.ogr_stbl_getlaststylenameMethod
OGR_STBL_GetLastStyleName(OGRStyleTableH hStyleTable) -> const char *

Get the style name of the last style string fetched with OGRSTBLGetNextStyle.

Parameters

  • hStyleTable: handle to the style table.

Returns

the Name of the last style string or NULL on error.

GDAL.ogr_stbl_getnextstyleMethod
OGR_STBL_GetNextStyle(OGRStyleTableH hStyleTable) -> const char *

Get the next style string from the table.

Parameters

  • hStyleTable: handle to the style table.

Returns

the next style string or NULL on error.

GDAL.ogr_stbl_loadstyletableMethod
OGR_STBL_LoadStyleTable(OGRStyleTableH hStyleTable,
                        const char * pszFilename) -> int

Load a style table from a file.

Parameters

  • hStyleTable: handle to the style table.
  • pszFilename: the name of the file to load from.

Returns

TRUE on success, FALSE on error

GDAL.ogr_stbl_resetstylestringreadingMethod
OGR_STBL_ResetStyleStringReading(OGRStyleTableH hStyleTable) -> void

Reset the next style pointer to 0.

Parameters

  • hStyleTable: handle to the style table.
GDAL.ogr_stbl_savestyletableMethod
OGR_STBL_SaveStyleTable(OGRStyleTableH hStyleTable,
                        const char * pszFilename) -> int

Save a style table to a file.

Parameters

  • hStyleTable: handle to the style table.
  • pszFilename: the name of the file to save to.

Returns

TRUE on success, FALSE on error

GDAL.ogrbuildpolygonfromedgesMethod
OGRBuildPolygonFromEdges(OGRGeometryH hLines,
                         int bBestEffort,
                         int bAutoClose,
                         double dfTolerance,
                         OGRErr * peErr) -> OGRGeometryH

Build a ring from a bunch of arcs.

Parameters

  • hLines: handle to an OGRGeometryCollection (or OGRMultiLineString) containing the line string geometries to be built into rings.
  • bBestEffort: not yet implemented???.
  • bAutoClose: indicates if the ring should be close when first and last points of the ring are the same.
  • dfTolerance: tolerance into which two arcs are considered close enough to be joined.
  • peErr: OGRERRNONE on success, or OGRERRFAILURE on failure.

Returns

a handle to the new geometry, a polygon.

GDAL.ogrcallocMethod
OGRCalloc(size_t count,
          size_t size) -> void *
GDAL.ogrcontourwriterMethod
OGRContourWriter(double dfLevel,
                 int nPoints,
                 double * padfX,
                 double * padfY,
                 void * pInfo) -> CPLErr
GDAL.ogrcreatepreparedgeometryMethod
OGRCreatePreparedGeometry(OGRGeometryH hGeom) -> OGRPreparedGeometryH

Creates a prepared geometry.

Parameters

  • hGeom: input geometry to prepare.

Returns

handle to a prepared geometry.

GDAL.ogrdestroypreparedgeometryMethod
OGRDestroyPreparedGeometry(OGRPreparedGeometryH hPreparedGeom) -> void

Destroys a prepared geometry.

Parameters

  • hPreparedGeom: preprated geometry.
GDAL.ogrgeometrytypetonameMethod
OGRGeometryTypeToName(OGRwkbGeometryType eType) -> const char *

Fetch a human readable name corresponding to an OGRwkbGeometryType value.

Parameters

  • eType: the geometry type.

Returns

internal human readable string, or NULL on failure.

GDAL.ogrgetdriverMethod
OGRGetDriver(int) -> OGRSFDriverH

Fetch the indicated driver.

Parameters

  • iDriver: the driver index, from 0 to GetDriverCount()-1.

Returns

handle to the driver, or NULL if iDriver is out of range.