osgeo.ogr module
- osgeo.ogr.ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis, double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees) Geometry
- class osgeo.ogr.ArrowArray(*args)
Bases:
objectProxy of C++ ArrowArray class.
- GetChildrenCount(ArrowArray self) GIntBig
- GetLength(ArrowArray self) GIntBig
- class osgeo.ogr.ArrowArrayStream(*args, **kwargs)
Bases:
objectProxy of C++ ArrowArrayStream class.
- GetNextRecordBatch(ArrowArrayStream self, char ** options=None) ArrowArray
- GetSchema(ArrowArrayStream self) ArrowSchema
- class osgeo.ogr.ArrowSchema(*args)
Bases:
objectProxy of C++ ArrowSchema class.
- GetChild(ArrowSchema self, int iChild) ArrowSchema
- GetChildrenCount(ArrowSchema self) GIntBig
- GetName(ArrowSchema self) char const *
- osgeo.ogr.BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort=0, int bAutoClose=0, double dfTolerance=0) Geometry
- osgeo.ogr.CreateGeomCoordinatePrecision() GeomCoordinatePrecision
- osgeo.ogr.CreateRangeFieldDomainDateTime(char const * name, char const * description, char const * min, bool minIsInclusive, char const * max, double maxIsInclusive) FieldDomain
- osgeo.ogr.DontUseExceptions()
Disable exceptions in all GDAL related modules (osgeo.gdal, osgeo.ogr, osgeo.osr, osgeo.gnm). Note: prior to GDAL 3.7, this only affected the calling module
- class osgeo.ogr.ExceptionMgr(useExceptions=True)
Bases:
objectContext manager to manage Python Exception state for GDAL/OGR/OSR/GNM.
Separate exception state is maintained for each module (gdal, ogr, etc), and this class appears independently in all of them. This is built in top of calls to the older UseExceptions()/DontUseExceptions() functions.
Example:
>>> print(gdal.GetUseExceptions()) 0 >>> with gdal.ExceptionMgr(): ... # Exceptions are now in use ... print(gdal.GetUseExceptions()) 1 >>> >>> # Exception state has now been restored >>> print(gdal.GetUseExceptions()) 0
- osgeo.ogr.GT_GetSingle(OGRwkbGeometryType eType) OGRwkbGeometryType
- osgeo.ogr.GeneralCmdLineProcessor(char ** papszArgv, int nOptions=0) char **
- class osgeo.ogr.GeomCoordinatePrecision(*args, **kwargs)
Bases:
objectProxy of C++ OGRGeomCoordinatePrecisionShadow class.
- GetFormatSpecificOptions(GeomCoordinatePrecision self, char const * formatName) char **
- GetFormats(GeomCoordinatePrecision self) char **
- GetMResolution(GeomCoordinatePrecision self) double
- GetXYResolution(GeomCoordinatePrecision self) double
- GetZResolution(GeomCoordinatePrecision self) double
- Set(GeomCoordinatePrecision self, double xyResolution, double zResolution, double mResolution)
- SetFormatSpecificOptions(GeomCoordinatePrecision self, char const * formatName, char ** formatSpecificOptions)
- SetFromMeter(GeomCoordinatePrecision self, SpatialReference srs, double xyMeterResolution, double zMeterResolution, double mResolution)
- class osgeo.ogr.GeomTransformer(*args)
Bases:
objectProxy of C++ OGRGeomTransformerShadow class.
- osgeo.ogr.GetDriver(int driver_number) OGRDriverShadow *
- osgeo.ogr.GetDriverByName(char const * name) OGRDriverShadow *
Get a vector driver. Like
gdal.GetDriverByName(), but only returns drivers that handle vector data.- Parameters:
name (str) -- name of the driver to fetch
- Return type:
Examples
>>> ogr.GetDriverByName('ESRI Shapefile').GetDescription() 'ESRI Shapefile'
>>> ogr.GetDriverByName('GTiff') >>>
- osgeo.ogr.GetDriverCount() int
- osgeo.ogr.GetGEOSVersionMajor() int
- osgeo.ogr.GetGEOSVersionMicro() int
- osgeo.ogr.GetGEOSVersionMinor() int
- osgeo.ogr.GetNonLinearGeometriesEnabledFlag() int
- osgeo.ogr.GetOpenDS(int ds_number) OGRDataSourceShadow *
- osgeo.ogr.GetOpenDSCount() int
- osgeo.ogr.GetUseExceptions() int
- class osgeo.ogr.MajorObject(*args, **kwargs)
Bases:
objectProxy of C++ GDALMajorObjectShadow class.
- GetDescription(MajorObject self) char const *
- GetMetadata(domain='')
- GetMetadataDomainList(MajorObject self) char **
- GetMetadataItem(MajorObject self, char const * pszName, char const * pszDomain="") char const *
- GetMetadata_Dict(MajorObject self, char const * pszDomain="") char **
- GetMetadata_List(MajorObject self, char const * pszDomain="") char **
- SetDescription(MajorObject self, char const * pszNewDesc)
- SetMetadata(MajorObject self, char ** papszMetadata, char const * pszDomain="") CPLErr
- SetMetadata(MajorObject self, char * pszMetadataString, char const * pszDomain="") CPLErr
- SetMetadataItem(MajorObject self, char const * pszName, char const * pszValue, char const * pszDomain="") CPLErr
- osgeo.ogr.Open(char const * utf8_path, int update=0) OGRDataSourceShadow *
Open a vector file as a
gdal.Dataset. Equivalent to callinggdal.OpenEx()with thegdal.OF_VECTORflag.- Parameters:
utf8_path (str) -- name of the file to open
- Return type:
gdal.Dataset, or
Noneon failure
Examples
>>> from osgeo import ogr >>> ogr.GetDriverByName('ESRI Shapefile').GetDescription() 'ESRI Shapefile' >>> ogr.GetDriverByName('GTiff') >>>
Open a vector file as a
gdal.Dataset. If the file has already been opened in the current thread, return a reference to the already-openedgdal.Dataset. Equivalent to callinggdal.OpenEx()with thegdal.OF_VECTORandgdal.OF_SHAREDflags.- Parameters:
utf8_path (str) -- name of the file to open
- Return type:
gdal.Dataset, or
Noneon failure
- class osgeo.ogr.PreparedGeometry(*args, **kwargs)
Bases:
objectProxy of C++ OGRPreparedGeometryShadow class.
- Contains(PreparedGeometry self, Geometry otherGeom) bool
- Intersects(PreparedGeometry self, Geometry otherGeom) bool
- osgeo.ogr.RegisterAll()
- osgeo.ogr.SetGenerate_DB2_V72_BYTE_ORDER(int bGenerate_DB2_V72_BYTE_ORDER) OGRErr
- osgeo.ogr.SetNonLinearGeometriesEnabledFlag(int bFlag)
- osgeo.ogr.TermProgress_nocb(double dfProgress, char const * pszMessage=None, void * pData=None) int
- osgeo.ogr.UseExceptions()
Enable exceptions in all GDAL related modules (osgeo.gdal, osgeo.ogr, osgeo.osr, osgeo.gnm). Note: prior to GDAL 3.7, this only affected the calling module