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

For an academic project involving road maintenance, I need to create a routing graph from geographical data. I was wondering whether someone could tell me whether creating the following graph is possible using OSM data. A 'traditional' routing graph would be something like: a vertex is an intersection, an edge between 2 vertices connects 2 intersections. In my application I need something more fine-grained. I need to create the following multigraph:

  • an arc (=directed edge) models a driving lane.
  • an edge models a street consisting of 1 lane which can be driven in both directions
  • When there are two arcs say (i,j) and (j,k), it must be allowed to drive from lane (i,j) to (j,k).

Example. Given the following intersection at the top of the picture. Let's assume that u-turns are not permitted. The arrows indicate driving directions for each lane. At the bottom you see the resulting routing graph which implements all traffic rules. U-turns are easily incorporated by 'merging' two nodes. alt text

For each lane I need to know it's length and the allowed driving speed. I'm only interested in roads for cars (no walkways/bicycle lanes). It would be great if someone could tell me whether it is possible to extract this kind of data from OSM. Any examples, references to existing code or references to relevant documentation are highly appreciated. If this is not possible in OSM, do you know other data sources which I could use instead (e.g. Google maps, HERE maps, etc)?

asked 09 Jun '15, 21:06

JorisK's gravatar image

accept rate: 0%

A lane based directed routing graph is possible, even if I don't know which toolset can help you. You might check out TrafficMining framework or start using pgrouting and tune osm2pgrouting. Also eWorld might be an idea?

permanent link

answered 09 Jun '15, 21:59

iii's gravatar image

accept rate: 10%

In those locations where OSM has lane data (which is far from everywhere), generating a graph according to your specifications is possible.

Relevant documentation can be found here:

I don't know any library that does this for you, however. So if the suggestions by @iii don't do what you want, you would have to do it yourself.

permanent link

answered 17 Jun '15, 18:01

Tordanik's gravatar image

accept rate: 35%

You could use GraphHopper as a starting point for this. Then you already have a good routing graph for cars. For detailed lane support you'll need to tweak it a bit, but as GraphHopper supports any directed graph in its lower level Java API you can model nearly anything with it.

Disclaimer: I'm the author

permanent link

answered 19 Jun '15, 22:15

peatar's gravatar image

accept rate: 8%

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 Jun '15, 21:06

question was seen: 7,681 times

last updated: 19 Jun '15, 22:15

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