After importing my country roads from OSM data, I need to create a network ( roads connecting big cities ) for use with pgRouting.

For this, I need the green, blue and red ones (http://www.openstreetmap.org/#map=11/-29.8582/-51.5238) but I'm unsure how to select them in database, since OSM is not clear about how to find them.

I just try http://taginfo.openstreetmap.org/keys/highway#values using PRIMARY and SECONDARY tag values, but the result sometimes gives me the orange and yellow ones too.


3 Answers 3


As already mentioned you have to look at the highway key.

The colors you are talking about are defined by the rendering stylesheet and represent the following tags:

  • blue: highway=motorway, highway=motorway_link
  • green: highway=trunk, highway=trunk_link
  • red: highway=primary, highway=primary_link
  • orange: highway=secondary, highway=secondary_link
  • yellow: highway=tertiary, highway=tertiary_link

For more details on the colors refer to the stylesheet of the current default layer at openstreetmap.org. There is also a description on the international equivalence of these values.


Use the OpenStreetMap (OSM) Key for Highways:



It's true, what is in special interest in this case are all objects with highway=* tagged.

BUT usually all the processing is already done by OSM2pgrouting and you don't need to struggle around with tagging schemas etc.
If you then want to tweak the routing itself, you might consult the pgrouting manual.

So you download an OSM planet extract, (optional filter it for highway=* objects using osmosis) and drop it to osm2pgrouting.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.