Hi, I'm pretty new to Python and extremely new to OSM, but I'm hoping to use OSM's data to calculate shortest walking paths on my college campus. Do you guys have any suggestions on how to start doing this? I'm having trouble understanding how to access and identify specific walking paths. Thanks. asked 09 Feb '20, 05:58 Jklod |
Your first task is to get OpenStreetMap data and transform it into a routable graph. I wouldn't recommend reinventing the wheel for this: you can use osm4routing (Python) or osm4routing2 (Rust) for this. Both are available on github. In osm4routing2's output data, it'll signify whether a particular way is routable for pedestrians or not. You can then build your shortest-path algorithm on this data. I'd suggest you start with the (unidirectional) Dijkstra algorithm, which is simple and understandable. There are lots of resources online explaining how to implement Dijkstra in Python. Once you've got the hang of that, you can move on to slightly more advanced algorithms such as bidirectional Dijkstra, A*, etc. etc. answered 10 Feb '20, 14:55 Richard ♦ |
Please have a look at the Routing page on the OSM wiki. It has a lot of information, also for developpers. Most types of highway are accessible to pedestrian, but you have to consider several tags to be sure ( access,foot...). I'm not sure you can start from scratch, unless you have a lot of free time, this is a really complex problem. answered 10 Feb '20, 11:58 H_mlet |
Are you looking for an API that will do all the work for you; or some ready-made library code that you can host locally; or do you want to write the whole thing from scratch?
I'd like to find a way to access the data, but do the work of computing shortest paths and displaying them manually. Though if there are resources that would help me do this manually that'd be useful.
Especially for walking, you need to be aware of data quality and usage as it's more complicated than driving.