OpenStreetMap logo OpenStreetMap

Efficiently adding direction=* to highway=give_way/stop

Posted by species on 20 October 2015 in English. Last updated on 25 October 2015.

I recently stumbled upon the direction=forward/backward key. It can be used to denote from which side a highway=give_way or stop is valid. Without that tag, a router would add a penalty also when crossing from the ‘wrong’ side, which would lead to wrongly calculated travel times.

As we have a lot of give_way- and stop-signs mapped in Graz (~1500), I was looking for an efficient way to add the direction=* info on it.

For adding “direction”, you need to know the direction of the underlying way. In the default JOSM map style this is only visible if you click on it. I was looking for a style that shows the way direction on default. I found none, so I wrote one. It is now available in JOSM via Settings → Map Paint Styles. Screenshot of style "Directions for traffic signs"

The style shows the direction of ways with a highway=give_way/stop/traffic_signals only (the ugly red >). I found no way to show the “direction”-tag by rotating the symbol or to show an arrow besides it in or against way direction, so I simply chose an up-arrow (↑) for “forward” and a down-arrow (↓) for “backward”. The orange background allows easy spotting of missing “direction”-tags.


I quickly got tired of searching for not-yet-tagged nodes in JOSM manually, so I wrote an Overpass Turbo query. Open the link, click Run to show give_way’s with missing direction, then Export → Load into JOSM. Now you can have all the traffic signs in your area at once in JOSM ☺. Screenshot of style "Directions for traffic signs" zoomed out

The orange rectangles show quickly where the tag is missing. My workflow to add them fast was:

  • Zoom in via scroll wheel close enough to clearly see the direction of ways
  • With the mouse, mark all (hold CTRL) orange nodes that are to be tagged “forward”
  • I keep direction=forward in my clipboard, so I press CTRL-SHIFT-V
  • Mark all that are “backward” (click the first without CTRL)
  • Press ALT-A (I keep direction=backward as last used tag); press Enter with my thumb on the Num-pad

If someone has a quicker work-flow, I’m always pleased to learn to map more efficiently ☺.


Just keep in mind, that JOSM doesn’t know about nodes tagged with a direction yet - so it doesn’t change the tag when you reverse the direction of a way!

I would hope to see the “direction”-tag implemented in some routers soon ☺

Discussion

Comment from Sanderd17 on 20 October 2015 at 17:18

Very nice work you’re doing.

Your workflow is ok, but you won’t get anywhere on your own. You should probably try to get it in as many editor and QA apps as possible.

  • The JOSM validator (warn that a tag is lacking on those nodes)
  • The JOSM and ID main style
  • QA sites like keepright and osmose

Also, the style could be improved. AFAIK, it’s possible to rotate icons to the way orientation, in which case you can make the arrow+stop sign rotated in the right direction (then you don’t need to show the way direction). See https://josm.openstreetmap.de/ticket/10217

This should make more mappers use this tagging, and in turn help the routers. I’m looking forward to that.

(note that some types of traffic light tagging could use the same direction tag, so you could apply the rendering there too.)

Comment from species on 23 October 2015 at 09:31

Thanks also for the hint with the validator, I’ve missed that possibility!

Yes, icon rotating is possible now - but only to absolute values, not relative to the parent road :-/ The only way I can imagine is to return the angles via some Java calls - where I don’t have the knowledge for.

Concerning Traffic lights (highway=traffic_signals) - yes, they are supported in the style too.

Thanks for you reply!

Comment from Klumbumbus on 29 October 2015 at 21:31

You can display the direction arrows for all ways in the josm settings -> display settings -> osm data -> draw direction arrows.

Regarding JOSM support of waydirection depending nodes, see e.g. https://josm.openstreetmap.de/ticket/10727 or https://josm.openstreetmap.de/ticket/10260

Comment from dieterdreist on 30 October 2015 at 09:05

I believe you should use a relation for these highway=give_way/stop, similar to how it is done with turn restrictions (from - via - (maybe) to). A direction=forward/backward on a node has no meaning, as it is referring to a way and not to a node. A node has one dimension and no direction.

Comment from MKnight on 30 October 2015 at 11:24

The export to josm (or other) works without running before too.

Comment from HalverHahn on 30 October 2015 at 11:37

This is a good idea. I had the same before 1-2 years, but I reject it because the editors don’t support the functionality… So now we need to teach the editors to change forward/backward at each node if a way is rotated.

The same can work for a kerb: up/down. And also for traffic lights.

Comment from species on 30 October 2015 at 11:40

@Mknight - yes, it works too in Overpass Turbo - But I want to be sure what I am actually loading in JOSM

Comment from species on 30 October 2015 at 17:06

@Klumbumbus - Thanks for the hint, didn’t know that! But I wanted to show the direction only on ways with a give_way/stop-sign.

Comment from species on 30 October 2015 at 17:12

@dieterdreist I prefer the KISS - “keep it simple stupid”-principle. As it is with turn lanes and destination on ways, I urge for no relations, if it can be done simpler. Who says it has no meaning? The meaning is created by people/algorithms from its context! And if the parent giving the context is a way or relation, that doesn’t matter.

Btw. - I wasn’t the one suggesting direction=forward/backward. I simply found it in the Wiki - so discussions about this tag are better done in the Talk:-section of the page or on the tagging-ML.

Comment from species on 30 October 2015 at 17:14

@Klumbumbus - thanks for the hint (via #10727) to traffic_signals:direction! I’ve updated the style to also support that key.

Log in to leave a comment