Extracting primary and secondary roads from OpenStreetMap data

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:

http://wiki.openstreetmap.org/wiki/Key:highway


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.