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, 05:58

Jklod's gravatar image

Jklod
214
accept rate: 0%

3

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, 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:40) Jklod
1

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

(10 Feb, 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, 14:55

Richard's gravatar image

Richard ♦
28.1k40249373
accept rate: 20%

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, 11:58

H_mlet's gravatar image

H_mlet
476215
accept rate: 20%

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×179

question asked: 09 Feb, 05:58

question was seen: 104 times

last updated: 10 Feb, 14:55

powered by OSQA