I want to perform shortest-path analysis on a network whose edges represent real-world roads and whose nodes are buildings or other locations.
I have the shapefile for the area I'm interested in.
How can I represent the shapefile data as a network? I have the NetworkX package for performing analysis in Python, but I don't actually know how to create the network in the first place.
I'm using Grass GIS and don't have access to ArcGIS.
Thanks.
EDIT: I should add that this is my first experience with anything GIS-related whatsoever.
2 Answers 2
If all you need is the shortest path analysis, and if you don't have much experience with GIS, then you can simply use the RoadGraph Plugin. With it, you can use distance or time to calculate the shortest path.
enter image description here
You can find some instructions in the QGIS User manual.
Make sure your project is in the same Coordinate System that your road data, and that the lines vertexes connect each other.
If you need more advanced analysis or more control, as ppardoz already said, Pgrouting and Postgis is probably the way to go. In PgRouting site there is a very nice tutorial of how to perform several network analysis.