Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

read_shp

read_shp(path)[source]

Generates a networkx.DiGraph from shapefiles. 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. Accepts a single shapefile or directory of many shapefiles.

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

Parameters:

path : file or string

File, directory, or filename to read.

Returns:

G : NetworkX graph

References

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

Examples

>>> G=nx.read_shp('test.shp')