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

I'm looking for algorithm which could help me with building my own road network (for routing) from OSM data.

I chose Spatialite DB for this, but here I have only one problem: Spatialite provides interface for build road network, but prepared road graph is saved in BLOBS so I can't get any information about it (of course, I can write queries to DB for routing facilities) but I want to draw all links on my map, so I need to get their coordinates.

Actually, I'm not sure if Spatialite could provide such API or smith like that.

I don't understand how to define junctions(links) between roads through all this data. My first idea was that all ways could be used as the arcs of graph. But I'm not sure if they doesn't consist links inside them. I mean that in <way> first and last nodes always links and only they, whereas other nodes mentioned in this <way> is used only for geometry of they way

Is that statement right ?

asked 20 Nov '13, 10:25

TemaKrukovets's gravatar image

accept rate: 0%


This is not quite correct. The first and the last node don't have to be links, a way can have one or even two open ends. Furthermore every node in the way can be part of one or more other ways, thus creating a junction. This is not limited to the first and last node.

(20 Nov '13, 10:33) scai ♦

@scai , So, how can i define links to build graph? Manually look for nodes which mentioned in 2 or more ways ?

(20 Nov '13, 10:44) TemaKrukovets

Yes. But you wouldn't do that manually. Enter the term "graph" in the search box above and read some of the results.

(20 Nov '13, 10:51) Frederik Ramm ♦

The preprocessing of OSM data for routing can be very tricky, as you have to take a lot of stuff into account (access and surface tags, restrictions, defaults per country, ...).

If you just like to create/try an routing algorithm, you might try this framework, that creates already a graph for you: You might also consider other existing solutions as osm2pgrouting if you aren't tied to Spatiallite DB

permanent link

answered 21 Nov '13, 09:40

iii's gravatar image

accept rate: 10%

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: 20 Nov '13, 10:25

question was seen: 5,522 times

last updated: 21 Nov '13, 09:40

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