NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

accept rate: 0%


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?

(09 Feb '20, 11:28) Richard ♦

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.

(09 Feb '20, 20:40) Jklod

Especially for walking, you need to be aware of data quality and usage as it's more complicated than driving.

(10 Feb '20, 13:44) Kovoschiz

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.

permanent link

answered 10 Feb '20, 14:55

Richard's gravatar image

Richard ♦
accept rate: 18%

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.

permanent link

answered 10 Feb '20, 11:58

H_mlet's gravatar image

accept rate: 13%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 09 Feb '20, 05:58

question was seen: 1,892 times

last updated: 10 Feb '20, 14:55

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum