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 |
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: http://code.google.com/p/trafficmining/. You might also consider other existing solutions as osm2pgrouting if you aren't tied to Spatiallite DB http://wiki.openstreetmap.org/wiki/Routing answered 21 Nov '13, 09:40 iii |
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.
@scai , So, how can i define links to build graph? Manually look for nodes which mentioned in 2 or more ways ?
Yes. But you wouldn't do that manually. Enter the term "graph" in the search box above and read some of the results.