User:Henry Loenwind/ACR

From OpenStreetMap Wiki
Jump to: navigation, search

Junction Routing Path Relation


The junction routing path relation (JRPR) is intended to describe all possible transitions from one street to another that can happen at a junction. As such it is quite complicated, but it is not intended to replace existing relations or tags, but to help model junction that can not be described correctly using these. So if a simple turn restriction relation is enough for your junction, just use that easier tun restriction relation.

About the model

The JRPR sees a crossing as a number of ways that have exactly 2 ends. Any possible path then can be describes as a series of ways. For any of those paths, the JRPR describes how a human driving (cycling/riding/walking/...) along it would experience it. Or, to name the expected usage, what a satnav (a.k.a. GPS, a.k.a. navi) would have to announce so the human would take that path.

A former revision of this relation included the nodes where those ways are joined. To simplify the relation, this has been removed. However this implies one restriction: No two ways in the relation can be connected with both their ends to each other.


The type of the relation is "junction".


All ways belonging to the junction (that includes the ways that only have one end at the junction) are included in the relation exactly once. Their role must be an unique (within the relation) string containing numbers and letter only. Please note that that is a difference to other relations that have fixed role names.


Every tag describes one path in the junction, that may be a complete path through the junction, or just one step. Generally speaking one path corresponds to one announcement of the satnav system.

Tag Keys

Tag keys are constructed from the role names. Again here this relation differs from other relations that use fixed key names.

To construct the key, concatenate the role names of all parts of the path, separated with an underscore ("_").

Tag Values

The value describes the path. Possible values are:

no - this path cannot be taken (this is the default for all thinkable paths that are not modeled).

auto - this path will be taken automatically by following the road. A satnav does not need (nor should) announce anything.

straight - to take this path, you must go straight ahead, leaving the road you're on.

right, left - turn right or left to take this path.

sharp right, sharp left - make a sharp turn. Use this only if you've already have used up the right/left or if it would be difficult to follow the satnav's directions with a simple left/right announcement.

half right, half left - see sharp

uturn - this is a u-turn at a position where it is allowed and possible. Use this one for special u-turn lanes. The satnav should announce this as a definite instruction.

possible uturn - here it is possible to turn, but there are no special lanes or signs. The satnav should announce this with care, e.g. by adding "if possible" to it's instruction. (Please note that a pedestrian can always and everywhere do a u-turn. No need to model that...) Note: We need a better name for this!

exit right, exit left - this is an exit from a motorway or trunk road, or some construct that looks&feels the same.

right lane, left lane, center lane - here the driver has to chose the right lane, that later will move away from the main body of the street. No turning involved.

parallel lane - this is the special lane at large motorway crossings that runs parallel to the main body and leads to the real exits. Hint: To use such a crossing you'd need to follow "exit, exit" or "exit, parallel, exit".

roundabout 1, roundabout 2, etc. - this is a path leading through a roundabout, the number says which exit from the roundabout to the, e.g. "leave the roundabout at the 3rd exit". As an exception to the rule that all ways must have exactly two ends, a roundabout circle way does not have to be cut into segments when using this value.

roundabout 1 right, roundabout 3 straight, etc. - any numbered roundabout exit may optionally be appended with one of the directions "right" or "straight" for countries driving on the right side or "left"/"straight" for countries driving on the wro...oops left side. A setnav may use these hints to give different instructions for simple roundabouts.

cross, cross at lights, cross at crossing - these are specials for people that can cross a street (pedestrians, cyclists, riders). A satnav should announce them like "cross the street at the traffic light".

right and cross, sharp left and cross at light, etc. - all of the "cross" values can be appended with an "and" to the right/left values defined above.




Example 1 - Complex Junction

Example 1, map view (click to enlarge)

This is a real junction in Heidelberg, Germany. I have simplified it a little bit for this example. There's a tram, tram stop and some cycleways in reality, but for now let's concentrate in the streets:

A note on the streets: 1x and 2x are different side of the same street. Both halfs are oneway. Same goes for 33-32 and 45. 41-42-42 and 36 are different streets, but they are both oneway. 5 is an underpass, bypassing the junction. 35, 44, and the 6x are just lanes, but they are needed to model the junction correctly. (And I did NOT add them for this example or the relation.)

Example 1, labelled (click to enlarge)

Now I want to be able to refer to the ways and nodes of this junction. So I labelled them:

That's quite a number of ways and nodes, isn't it? You may also notice that I split some ways that usually would not be split. There are 2 reasons for this: First the relation really works best if any way only has two ends. Second I had some problems with overlapping labels and unclear numbering when making the image, so I split all ways between all named nodes.

So let's create the relation for this junction. We need all ways that are labelled in the image to be members of the relation. Then all of them need a unique "role", for this example I just used the label you see in the image. In reality you'd use more meaningful role names. This is how the relation now looks in JOSM:

Example 1, the relation (click to enlarge)

Attention: Ignore the listed nodes in the picture. It's outdated.

(BTW: The lat/lon values shown are junk because I copied the data into a new layer. Don't try to find the junction there...)

The next step is to identify all paths through the junction. Remember, a path corresponds to an announcement of your satnav, not to a complete way through the junction. There are quite many paths in this junction, so we better work systematically---starting at way 11.

Example 1, selected paths

From way 11 we can turn right into way 36: "11_36=right"

We can also do a u-turn here, via way 35 back to 24: "11_35_23=uturn" You'll notice I did not complete this with "_24", that is not needed, because we'll also add: "23_24=auto"

But back to way 11. We can also continue driving there, and we'll end up on way 12. So: "11_12=auto"

So far for way 11, no other ways to go (legally at least). So let's have a look at way 12.

From way 12 we can go (at node B only, remember: oneway) into way 13: "12_13=auto" or we can turn left: "12_62_45=left". I added the "_45" for clearness, and because this is the only way to get onto 62, so no need to split this path (like the 23 above). So, the next question is, can u-turn here? 12-62-22 or 12-62-63? Physically yes, but not legally, so we leave those paths out. That's it for 12.

Way 13 leads straight ahead, it's not allowed to turn into 43 or 44: "13_14=auto"

Same for way 14, no way to turn: "14_15=auto". Way 15 leads away from the junction, so no path starts here.

Way 21 is more interesting. We can turn right: "2_45=right", or just drive on: "21_22=auto", or we can prepare to turn left: "21_63=left lane" and then "63_36=auto". But the "left lane" thing is a little bit oversized here, it's not a motorway. So we better make it "21_63_36=half left". Yes, that's half left, not left. A simple "left" would send people into way 44, and we do not want that.

Let's continue with way 22. That boring thing just goes straight ahead: "22_23=auto". We did "23_24=auto" already above, and 24 leaves the map, so we are finished with the 2x ways. (I ignored some possible uturns---I know the junction, and no sane person would try them. Trust me.)

Coming from way 31 we don't really have a choice: "31_32=auto" and "32_33=auto". That's 2 paths because we don't want to be cruel to a satnav hat get's its fix in the middle of 32. Not likely to happen, is it?

While 31 and 32 are not oneway, 45 and 5 are, so we have all paths in this direction. We'll revisit H and J when we do the opposite direction.

Way 33 is more interesting again. We can go right: "33_64_24=right lane", left: "33_34_35_12=left lane" or straight ahead: "33_34_35_36=center lane". Yeah, we got lanes here, 5 of them. 1 goes right, 2 straight and 2 left, so we better give a full lane-setup. And with this we already finished 33 to 36 and 64. Let's move on.

Way 41. Reality say we've got 4 lanes, 2 down under the bridge and 2 up onto the bridge. So it's again time for a lane setup: "41_5=right lane" and "41_42=left lane".

Same goes for way 42, again 4 lanes. But slightly more complicated, observe: "42_61=right lane" and "61_15=right" for the first direction. We get both "right lane" and "right", to make sure the driver understands us. We could leave out either one of them, but that may not be the best way to tell the way. ow the rest: "42_43=left lane", "43_44_45=straight" (or auto), "43_44_22=half left". And now the bonus: "43_44_63_36=sharp left".

Don't forget way 45: "45_32=auto". No legal turning into 33 here. And last but not least way 5: "5_31=auto".

That's all. Here are all roles together:

21_63_36=half left
33_64_24=right lane
33_34_35_12=left lane
33_34_35_36=center lane
41_5=right lane
41_42=left lane
42_61=right lane
42_43=left lane
43_44_22=half left
43_44_63_36=sharp left

What? Such a bug junction and just this handful of tags? Now that wasn't that extreme, was it?

Example 2 - Motorway Junction

Example 2, labelled (click to enlarge)

Our next example will be a typical German cloverleaf. However, as it wold be a little bit big, I'll be using just a fourth of it for tis example. Here is the picture:

Oops, it's not blue? Yes, I changed the colors for this example. Black text on blue lines wasn't really readable.

Again, we add all ways to the relation as above. Again I labelled the ways and nodes with rather unimaginative names (roles) to make the example easier to follow.

Finding the paths is straightforward:

Starting on way 11, arriving at node A, we can either stay on the motorway and ignore the junction ("11_12=auto") or take the exit ("11_21=exit right").

So we took the exit, now we again have 2 choices at node B, take the first exit ("12_31=exit right") or head for the second ("21_22=parallel lane" and "22_23=auto").

If we took the first exit we are not on way 31. We'll pass through node E ("31_43=auto") and through node F ("43_62=auto") and are finished with turning right.

If we headed for the second exit, we just left the picture. Let's reenter on way 41, that's the same just from another motorway. We arrive at node D and need to decide, take the exit ("41_51=exit right") or head back to the main body of the motorway ("41_42=auto", "42_43=auto" and finally "43_62=auto").

Now, after we took the second exit, we arrive at node C, no choices here ("51_23=auto").

The only remaining path is at node F, the main part of the motorway continues, of cause ("61_62=auto").

Let's sum up again:

11_21=exit right
12_31=exit right
21_22=parallel lane
41_51=exit right

That's all for a quarter of a cloverleaf. The other 3 quarters are the same again.

PS: There's one catch. We ignored the bridge! You see, way 12 is split because there is a bridge. So that part of 12 where the bridge is, should really be way 13 with "12_13=auto". Easy so miss, isn't it? And btw, same for way 23...