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

I've built an OSM road dataset (from a shapefile to a .osm in JOSM), in which each unique feature has been assigned a 'highway' tag. I've declared oneways and bridges in the proper syntax as well. This dataset is going to be used in a mobile routing application, which I am currently beta testing with a developer. The one-ways and the turn restrictions that I've already built are being recognized and followed in solving routes in this application currently, but I would like to build-in some kind of hierarchy as well so that a 'primary' road is given preference over an 'unclassified' when solving a route.

I had thought originally that the 'highway' tag would do this automatically, but that does not seem to be the case. What is it that I am missing?

asked 06 Dec '12, 19:56

jrand's gravatar image

jrand
25113
accept rate: 0%

edited 06 Dec '12, 19:57

Your question seems to be not an FAQ but mote a topic that would be beter placed to one of the OSM mailing lists, maybe the one about Routing or developing ... see http://wiki.openstreetmap.org/wiki/Mailing_lists

(09 Dec '12, 21:01) stephan75
1

What do you mean with "given preference"?

When you develop a router, you need a method that calculates the weight for every part of the road. This can happen based on a lot of tags s.a. the highway tag, maxspeed, No of lanes ...

For OSM data, tags are only key-value pairs. The data user needs to give a meaning on it.

(11 Dec '12, 15:11) Sanderd17

It is true that the "highway" tag is defining the road importance in the traffic. But nothing is "automatic". Your software will have to translate a "highway" value into a speed/importance factor. For instance, a "highway=primary" will be prefered to a "highway=track". JOSM editor will not help you in this matter. You have to know that "primary" is more important than "secondary" which is more important than "tertiary" then "unclassified", etc... See for instance how OSRM is defining a speed profile for highway values. As hint, you should notice that the wiki table about "highway" is already sorted by importance (Starting with "motorway" and finishing with "service"/"track"). Some values can be considered as equivalent.

But more importantly, your software will have to check if the "highway" is accessible for your vehicles (cars ? motorbikes ? trucks ?) by checking the highway value (e.g. the "highway=cycleway" is not allowed for cars) combined with the "access" tags.

For instance, an "access=no" or "access=private" is not allowed for cars but ("access=no" + "motorcar=yes") or ("access=no" + "motor_vehicle=yes") or "access=motorocar" or "access=motor_vehicle" is allowed. Or "access=destination" is allowed but only if the concerned street is the route final destination... Sometimes, the "access" tag may allow motorcars where it is presumed forbidden, e.g. a combination of "highway=path" + "motorcar=yes" is bit exotic tagging since we assume that "path" is normally not open for 4 wheels vehicles but if a contributor specified explicitely "motorcar=yes", the access tag is more important than the "highway" value (but what is tolerated for "path" might be considered as a tagging error for other values e.g. if you combine "highway=footway" + "motorcar=yes").

You might also have to check if some nodes on your ways contain the tag "barrier" which is most probably blocking your vehicle again (for cars, it's quite easy : all "barrier" values shall stop you excepted perhaps the improbable "barrier=no"; for bicycles, it's more difficult since barriers might be passable or not depending on the value).

So, as you see, creating a routing software with OSM data requires a good knowledge of OSM tags and also current practices. You can study the wiki for that and also check the data itself and the different combinations. You also have to accept that contributors can do mistakes. If you route is wrong, it can be your algorithm ignoring a specific tag but it can be the data itself as well (tags and/or geometry). In case of doubts, you can ask the community here or on the mailing lists. You should also start with a limited amount of tags and simply admit publicly that you are only handling the most usual and simple cases at start ;-)

permanent link

answered 12 Dec '12, 13:46

Pieren's gravatar image

Pieren
9.8k2083157
accept rate: 15%

edited 12 Dec '12, 14:03

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×622
×305
×86
×14

question asked: 06 Dec '12, 19:56

question was seen: 4,973 times

last updated: 12 Dec '12, 14:03

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