How to create a road network from exported OSM data.


I’m new to this so please forgive me if this question is dumb. I am writing code to parse the XML data exported from OSM so I can reconsistute a road network in a computer app I’m writing for research. So far I’ve succeeded in extracting the road (way) data and rendering the ways in my app. What I need to do now is understand how the roads join at junctions so I can build a network or nodes and edges which describes the road system in my app. It’s not clear to me if that data is in the exported data? Can someone advise me on this please?

The only way I can see to do currentluy is to search for nodes which are shared between ways and assume that those are where the ways join. That seems like it would work?

That’s correct - junctions are modeled as a common node in OSM.

Thanks Mike,

That’s what I’ve done and it appears to be working. Although I’m not clear what all the tags that roads have mean. For example if a road has a Highway tag which is set to “Cyclepath” and a cyclepath tag does that mean it’s suitable for vehicles and has a cycle path on the side or that it is a dedicated cycle path?

Is there a document somewhere which lists all the tags “ways” and “Relations” can have?

Thanks again for your help!



Most of the common tags used in OSM should be listed on the map features page:
Or specifically for the highway tags:

Re your specific question, for the tag highway=cycleway, that means its just a cycle path, so probably not suitable for motor vehicles etc.
Whereas if the tag is something like highway=primary or highway=unclassified etc, that means its a road. Plus if the way also has a tag of cycleway=track or cycleway=lane that means there is a cycle path or lane next to or on the road.