osgeo.gnm module

osgeo.gnm.CastToGenericNetwork(MajorObject base) GenericNetwork
osgeo.gnm.CastToNetwork(MajorObject base) Network
osgeo.gnm.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.gnm.ExceptionMgr(useExceptions=True)

Bases: object

Context 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
class osgeo.gnm.GenericNetwork(*args, **kwargs)

Bases: Network

Proxy of C++ GNMGenericNetworkShadow class.

ChangeAllBlockState(GenericNetwork self, bool bIsBlock=False) CPLErr
ChangeBlockState(GenericNetwork self, GIntBig nFID, bool bIsBlock) CPLErr
ConnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID, double dfCost, double dfInvCost, GNMDirection eDir) CPLErr
ConnectPointsByLines(GenericNetwork self, char ** papszLayerList, double dfTolerance, double dfCost, double dfInvCost, GNMDirection eDir) CPLErr
CreateRule(GenericNetwork self, char const * pszRuleStr) CPLErr
DeleteAllRules(GenericNetwork self) CPLErr
DeleteRule(GenericNetwork self, char const * pszRuleStr) CPLErr
DisconnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID) CPLErr
DisconnectFeaturesWithId(GenericNetwork self, GIntBig nFID) CPLErr
GetRules(GenericNetwork self) char **
ReconnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID, double dfCost, double dfInvCost, GNMDirection eDir) CPLErr
property thisown

The membership flag

osgeo.gnm.GetUseExceptions() int
class osgeo.gnm.Network(*args, **kwargs)

Bases: MajorObject

Proxy of C++ GNMNetworkShadow class.

CommitTransaction(Network self) OGRErr
CopyLayer(Network self, Layer src_layer, char const * new_name, char ** options=None) Layer
CreateLayer(Network self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown, char ** options=None) Layer
DeleteLayer(Network self, int index) OGRErr
DisconnectAll(Network self) CPLErr
GetFeatureByGlobalFID(Network self, GIntBig GFID) Feature
GetFileList(Network self) char **
GetLayerByIndex(Network self, int index=0) Layer
GetLayerByName(Network self, char const * layer_name) Layer
GetLayerCount(Network self) int
GetName(Network self) char const *
GetPath(Network self, GIntBig nStartFID, GIntBig nEndFID, GNMGraphAlgorithmType eAlgorithm, char ** options=None) Layer
GetProjection(Network self) char const *
GetProjectionRef(Network self) char const *
GetVersion(Network self) int
ReleaseResultSet(Network self, Layer layer)
RollbackTransaction(Network self) OGRErr
StartTransaction(Network self, int force=FALSE) OGRErr
TestCapability(Network self, char const * cap) bool
property thisown

The membership flag

osgeo.gnm.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