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
osgeo.ogr.BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort=0, int bAutoClose=0, double dfTolerance=0) Geometry
class osgeo.ogr.DataSource(*args, **kwargs)

ベースクラス: MajorObject

Proxy of C++ OGRDataSourceShadow class.

AbortSQL(DataSource self) OGRErr
CommitTransaction(DataSource self) OGRErr
CopyLayer(DataSource self, Layer src_layer, char const * new_name, char ** options=None) Layer

OGRLayerH OGR_DS_CopyLayer(OGRDataSourceH hDS, OGRLayerH hSrcLayer, const char *pszNewName, char **papszOptions)

Duplicate an existing layer.

This function creates a new layer, duplicate the field definitions of the source layer and then duplicate each features of the source layer. The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation. The source layer may come from another dataset.

Deprecated Use GDALDatasetCopyLayer() in GDAL 2.0

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.

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

CreateLayer(DataSource self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown, char ** options=None) Layer

OGRLayerH OGR_DS_CreateLayer(OGRDataSourceH hDS, const char *pszName, OGRSpatialReferenceH hSpatialRef, OGRwkbGeometryType eType, char **papszOptions)

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

The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation.

Deprecated Use GDALDatasetCreateLayer() in GDAL 2.0

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

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

DeleteLayer(value)

Deletes the layer given an index or layer name

Dereference()

For backwards compatibility only.

Destroy()

Once called, self has effectively been destroyed. Do not access. For backwards compatibility only

ExecuteSQL(DataSource self, char const * statement, Geometry spatialFilter=None, char const * dialect="") Layer

OGRLayerH OGR_DS_ExecuteSQL(OGRDataSourceH hDS, const char *pszStatement, OGRGeometryH hSpatialFilter, const char *pszDialect)

Execute an SQL statement against the data store.

The result of an SQL query is either NULL for statements that are in error, or that have no results set, or an OGRLayer handle representing a results set from the query. Note that this OGRLayer is in addition to the layers in the data store and must be destroyed with OGR_DS_ReleaseResultSet() before the data source is closed (destroyed).

For more information on the SQL dialect supported internally by OGR review theOGR SQL document. Some drivers (i.e. Oracle and PostGIS) pass the SQL directly through to the underlying RDBMS.

Starting with OGR 1.10, theSQLITE dialect can also be used.

Deprecated Use GDALDatasetExecuteSQL() in GDAL 2.0

Parameters:

hDS: handle to the data source on which the SQL query is executed.

pszSQLCommand: 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. Starting with OGR 1.10, the SQLITE dialect can also be used.

a handle to a OGRLayer containing the results of the query. Deallocate with OGR_DS_ReleaseResultSet().

FlushCache(DataSource self)
GetDriver(DataSource self) Driver

OGRSFDriverH OGR_DS_GetDriver(OGRDataSourceH hDS)

Returns the driver that the dataset was opened with.

NOTE: Starting with GDAL 2.0, it is NOT safe to cast the returned handle to OGRSFDriver*. If a C++ object is needed, the handle should be cast to GDALDriver*.

Deprecated Use GDALGetDatasetDriver() in GDAL 2.0

Parameters:

hDS: handle to the datasource

NULL if driver info is not available, or pointer to a driver owned by the OGRSFDriverManager.

GetLayer(iLayer=0)

Return the layer given an index or a name

GetLayerByIndex(DataSource self, int index=0) Layer
GetLayerByName(DataSource self, char const * layer_name) Layer

OGRLayerH OGR_DS_GetLayerByName(OGRDataSourceH hDS, const char *pszName)

Fetch a layer by name.

The returned layer remains owned by the OGRDataSource and should not be deleted by the application.

Deprecated Use GDALDatasetGetLayerByName() in GDAL 2.0

Parameters:

hDS: handle to the data source from which to get the layer.

pszLayerName: Layer the layer name of the layer to fetch.

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

GetLayerCount(DataSource self) int

int OGR_DS_GetLayerCount(OGRDataSourceH hDS)

Get the number of layers in this data source.

Deprecated Use GDALDatasetGetLayerCount() in GDAL 2.0

Parameters:

hDS: handle to the data source from which to get the number of layers.

layer count.

GetName(DataSource self) char const *

const char* OGR_DS_GetName(OGRDataSourceH hDS)

Returns the name of the data source.

This string should be sufficient to open the data source if passed to the same OGRSFDriver that this data source was opened with, but it need not be exactly the same string that was used to open the data source. Normally this is a filename.

Deprecated Use GDALGetDescription() in GDAL 2.0

Parameters:

hDS: handle to the data source to get the name from.

pointer to an internal name string which should not be modified or freed by the caller.

GetRefCount(DataSource self) int

int OGR_DS_GetRefCount(OGRDataSourceH hDataSource)

GetStyleTable(DataSource self) StyleTable

OGRStyleTableH OGR_DS_GetStyleTable(OGRDataSourceH hDS)

Get style table.

GetSummaryRefCount(DataSource self) int

int OGR_DS_GetSummaryRefCount(OGRDataSourceH hDataSource)

Reference()

For backwards compatibility only.

Release()

Once called, self has effectively been destroyed. Do not access. For backwards compatibility only

ReleaseResultSet(DataSource self, Layer layer)

void OGR_DS_ReleaseResultSet(OGRDataSourceH hDS, OGRLayerH hLayer)

Release results of OGR_DS_ExecuteSQL().

This function should only be used to deallocate OGRLayers resulting from an OGR_DS_ExecuteSQL() call on the same OGRDataSource. Failure to deallocate a results set before destroying the OGRDataSource may cause errors.

Deprecated Use GDALDatasetReleaseResultSet() in GDAL 2.0

Parameters:

hDS: a handle to the data source on which was executed an SQL query.

hLayer: handle to the result of a previous OGR_DS_ExecuteSQL() call.

RollbackTransaction(DataSource self) OGRErr
SetStyleTable(DataSource self, StyleTable table)

void OGR_DS_SetStyleTable(OGRDataSourceH hDS, OGRStyleTableH hStyleTable)

Set style table.

StartTransaction(DataSource self, int force=FALSE) OGRErr
SyncToDisk(DataSource self) OGRErr

OGRErr OGR_DS_SyncToDisk(OGRDataSourceH hDS)

Flush pending changes to disk.

See GDALDataset::FlushCache()

TestCapability(DataSource self, char const * cap) bool

int OGR_DS_TestCapability(OGRDataSourceH hDS, const char *pszCap)

Test if capability is available.

One of the following data source capability names can be passed into this function, and a TRUE or FALSE value will be returned indicating whether or not the capability is available for this object.

ODsCCreateLayer: True if this datasource can create new layers.

ODsCDeleteLayer: True if this datasource can delete existing layers.

ODsCCreateGeomFieldAfterCreateLayer: True if the layers of this datasource support CreateGeomField() just after layer creation.

ODsCCurveGeometries: True if this datasource supports writing curve geometries. (GDAL 2.0). In that case, OLCCurveGeometries must also be declared in layers of that dataset.

The #define macro forms of the capability names should be used in preference to the strings themselves to avoid misspelling.

Deprecated Use GDALDatasetTestCapability() in GDAL 2.0

Parameters:

hDS: handle to the data source against which to test the capability.

pszCapability: the capability to test.

TRUE if capability available otherwise FALSE.

property name

p.q(const).char

Type:

name

osgeo.ogr.DontUseExceptions()
class osgeo.ogr.Driver(*args, **kwargs)

ベースクラス: MajorObject

Proxy of C++ OGRDriverShadow class.

CopyDataSource(Driver self, DataSource copy_ds, char const * utf8_path, char ** options=None) DataSource
CreateDataSource(Driver self, char const * utf8_path, char ** options=None) DataSource
DeleteDataSource(Driver self, char const * utf8_path) int
Deregister(Driver self)
GetName(Driver self) char const *
Open(Driver self, char const * utf8_path, int update=0) DataSource
Register(Driver self)
TestCapability(Driver self, char const * cap) bool
property name

p.q(const).char

Type:

name

osgeo.ogr.GeneralCmdLineProcessor(char ** papszArgv, int nOptions=0) char **
class osgeo.ogr.GeomTransformer(*args)

ベースクラス: object

Proxy of C++ OGRGeomTransformerShadow class.

Transform(GeomTransformer self, Geometry src_geom) Geometry
osgeo.ogr.GetDriver(int driver_number) Driver
osgeo.ogr.GetDriverByName(char const * name) Driver
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) DataSource
osgeo.ogr.GetOpenDSCount() int
osgeo.ogr.GetUseExceptions() int
class osgeo.ogr.MajorObject(*args, **kwargs)

ベースクラス: object

Proxy of C++ GDALMajorObjectShadow class.

GetDescription(MajorObject self) char const *
GetMetadata(domain='')
GetMetadataDomainList(MajorObject self) char **
GetMetadataItem(MajorObject self, char const * pszName, char const * pszDomain="") char const *
GetMetadata_Dict(MajorObject self, char const * pszDomain="") char **
GetMetadata_List(MajorObject self, char const * pszDomain="") char **
SetDescription(MajorObject self, char const * pszNewDesc)
SetMetadata(MajorObject self, char ** papszMetadata, char const * pszDomain="") CPLErr
SetMetadata(MajorObject self, char * pszMetadataString, char const * pszDomain="") CPLErr
SetMetadataItem(MajorObject self, char const * pszName, char const * pszValue, char const * pszDomain="") CPLErr
osgeo.ogr.Open(char const * utf8_path, int update=0) DataSource
osgeo.ogr.OpenShared(char const * utf8_path, int update=0) DataSource
class osgeo.ogr.PreparedGeometry(*args, **kwargs)

ベースクラス: object

Proxy 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()