Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building graph structure from GIS data in Python

I want to implement a driving direction in Python using something like Djikstra's shortest path. The algorithm requires the data to be represents in graph structure. Raw GIS data (e.g. shape files or OpenStreetMap data, however, represent their data differently. Therefore, I was wondering is there any Python library that can convert GIS data to graph structure?

In Java I found that GeoTools has exactly what I described. Is there any similar library in Python?

like image 577
ejel Avatar asked May 20 '26 12:05

ejel


1 Answers

Haven't used it yet, but there's a function that generates directed graphs from shapefiles in Networkx: http://networkx.lanl.gov/reference/readwrite.nx_shp.html. If it doesn't do exactly what you need, it might suggest a solution. Uses OGR's Python bindings to read data.

See also Graphserver http://bmander.github.com/graphserver/.

like image 124
sgillies Avatar answered May 23 '26 13:05

sgillies