NetworkX

Previous topic

networkx.readwrite.nx_shp.read_shp

Next topic

Drawing

networkx.readwrite.nx_shp.read_shp

networkx.readwrite.nx_shp.read_shp(path)

Generate a directed graph from shapefiles.

“The Esri Shapefile or simply a shapefile is a popular geospatial vector data format for geographic information systems software [R132].”

Point geometries are translated into nodes, lines into edges. Coordinate tuples are used as keys. Attributes are preserved, line geometries are simplified into start and end coordinates.

Parameters :

path : string

File name or directory name.

Returns :

G : NetworkX DiGraph

Notes

Uses Python bindings for OGR in the GDAL library, http://www.gdal.org. Available for Linux in the python-gdal package.

References

[R132](1, 2) http://en.wikipedia.org/wiki/Shapefile

Examples

G=nx.read_shp(‘test.shp’)