Turn restrictions with role=via ways

Now, with all these routing improvements, I wonder if it would be possible to extend our support for turn restrictions. Some mapper seems to prefer via ways to via nodes in this crossing: http://www.openstreetmap.org/way/30692839 This 2-node way is a role=via member of a no_u_turn restriction that has 4 ways as members: from,via,via,to. It is also a role=via member of a no_left_turn restriction. The no_u_turn restriction could have been mapped with three ways as from,via,to and the no_left_turn could have been mapped with having this way as role=from, and a node as role=via. Even if I changed the map like that, mkgmap would still ignore the no_u_turn, because the role=via member would be a way. So, I wonder if we could start supporting this style of mapping? There are lots of dual carriageways in city areas where such turn restrictions are common, at least for no_u_turn. Marko

Hi Marko, I'll have a look at it. Gerd
Date: Fri, 14 Mar 2014 00:03:43 +0200 From: marko.makela@iki.fi To: mkgmap-dev@lists.mkgmap.org.uk Subject: [mkgmap-dev] Turn restrictions with role=via ways
Now, with all these routing improvements, I wonder if it would be possible to extend our support for turn restrictions.
Some mapper seems to prefer via ways to via nodes in this crossing:
http://www.openstreetmap.org/way/30692839
This 2-node way is a role=via member of a no_u_turn restriction that has 4 ways as members: from,via,via,to. It is also a role=via member of a no_left_turn restriction.
The no_u_turn restriction could have been mapped with three ways as from,via,to and the no_left_turn could have been mapped with having this way as role=from, and a node as role=via. Even if I changed the map like that, mkgmap would still ignore the no_u_turn, because the role=via member would be a way.
So, I wonder if we could start supporting this style of mapping? There are lots of dual carriageways in city areas where such turn restrictions are common, at least for no_u_turn.
Marko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Marko, I fear restrictions with multiple via ways are too complex, or I did not understand them If I got that right, we cannot simply convert them to normal restrictions, as they are somehow describing a list of ways which is not allowed to be travelled in that order. I cannot even think of a trafic sign for that :-( I am not sure if Garmin has a restriction type that allows multiple via points. We found out that it has a type that has more than 3 points, but I thought that this is used to list multiple "to" nodes. @Steve: Could it be that the 05 60 00 type restrictions have two via points? Gerd From: gpetermann_muenchen@hotmail.com To: mkgmap-dev@lists.mkgmap.org.uk Date: Mon, 17 Mar 2014 11:02:01 +0100 Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways Hi Marko, I'll have a look at it. Gerd
Date: Fri, 14 Mar 2014 00:03:43 +0200 From: marko.makela@iki.fi To: mkgmap-dev@lists.mkgmap.org.uk Subject: [mkgmap-dev] Turn restrictions with role=via ways
Now, with all these routing improvements, I wonder if it would be possible to extend our support for turn restrictions.
Some mapper seems to prefer via ways to via nodes in this crossing:
http://www.openstreetmap.org/way/30692839
This 2-node way is a role=via member of a no_u_turn restriction that has 4 ways as members: from,via,via,to. It is also a role=via member of a no_left_turn restriction.
The no_u_turn restriction could have been mapped with three ways as from,via,to and the no_left_turn could have been mapped with having this way as role=from, and a node as role=via. Even if I changed the map like that, mkgmap would still ignore the no_u_turn, because the role=via member would be a way.
So, I wonder if we could start supporting this style of mapping? There are lots of dual carriageways in city areas where such turn restrictions are common, at least for no_u_turn.
Marko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On 18/03/14 08:07, Gerd Petermann wrote:
@Steve: Could it be that the 05 60 00 type restrictions have two via points?
I know we discussed this before and at the time I hadn't examined any. But now I am fairly certain that all intermediate points are via points. Its not a strange situation, perhaps more of an optimisation rather than anything that there would be a traffic sign for. Imagine there are two two roads between A and D; ABCD and AD. You can travel AB and ABC, but there is a turn restriction from C to D. So the 'real' turn restriction is BCD, but they write it as ABCD, perhaps just so that the algorithm doesn't waste time exploring the wrong path if it is at A and needing to get to D. I've no idea how well that relates to what the OSM tags mean. ..Steve

Hi Steve, Gerd, On Tue, Mar 18, 2014 at 11:16:53AM +0000, Steve Ratcliffe wrote:
Imagine there are two two roads between A and D; ABCD and AD. You can travel AB and ABC, but there is a turn restriction from C to D. So the 'real' turn restriction is BCD, but they write it as ABCD, perhaps just so that the algorithm doesn't waste time exploring the wrong path if it is at A and needing to get to D.
I've no idea how well that relates to what the OSM tags mean.
I suspect that in the example that I posted, the mapper wanted to map for the renderer (JOSM in this case). If he used only from,via,to ways in the turn restriction, the "no turn allowed" traffic sign would show up in the middle of the junction (of two dual-oneway roads). It looks nicer in JOSM if the sign is before the junction, like in the real life. This is of course bogus, just like it is redundant to add a turn restriction that prohibits turning to an oneway road against the oneway direction. If you want to map traffic signs, there is an established tagging scheme for that in Finland. I did not contact the mapper yet to confirm if this is the case. Anyway, the problem is that the U-turn restriction is ABCD (A=from,B=via,C=via,D=to) while BCD (B=from,C=via,D=to) would suffice. AFAIU, other turn restrictions than no_u_turn can always be mapped without via ways (using via nodes). Do you agree? Could we automatically convert such turn restrictions to ones that use via nodes? The translation would do the following: 1. keep the role=to way as is 2. add role=via node at the junction of the role=via way and the role=to way 3. rename the role=via way from step 2 to role=from way 4. discard any other role=via ways, and all role=from ways Does this sound correct to you? Supporting role=via ways for no_u_turn would be a bigger task (requiring knowledge of the Garmin format). Marko

Hi Marko,
Anyway, the problem is that the U-turn restriction is ABCD (A=from,B=via,C=via,D=to) while BCD (B=from,C=via,D=to) would suffice.
BCD restriction would be interpreted as turn-left restriction for cars coming from other road, which in most cases would be wrong. There is no shortcut for 4-points U-turn restriction. I'm not sure, what are recommendation in OSM, but I think cgpsmapper is logical in its definition of restriction. Restriction should consist of nodes and ways between these nodes. There should be no guessing how to get from a node to next one. OSM relation can include only a part of these data, for example 2 nodes and a way or 4 nodes. Any combination should be interpreted, converted to standard definition and used if can be stored in Garmin format. -- Best regards, Andrzej

Hi, one note more: very often U-Turn restriction is defined as 4-points ABCA, which creates a closed loop. I'm not sure if this would be a special case for mkgmap. -- Best regards, Andrzej

Hi all, so far I've coded the write routine and a parser for the polish format. Does anybody have a valid mp file that contains 4 node restrictions like this: [RESTRICT] TraffPoints=25009,25008,16968,16967 TraffRoads=532674,520763,520763 [END-RESTRICT] Gerd
Date: Tue, 18 Mar 2014 17:26:50 +0100 From: popej@poczta.onet.pl To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways
Hi,
one note more: very often U-Turn restriction is defined as 4-points ABCA, which creates a closed loop. I'm not sure if this would be a special case for mkgmap.
-- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Gerd,
Does anybody have a valid mp file that contains 4 node restrictions
here is attached a small sample with a restriction, this example comes from http://ump.waw.pl/en/index.html If you'd like to test a real piece of mp source, I have uploaded full region form UMP, it include img compiled by cgpsmapper: http://files.mkgmap.org.uk/download/185/UMP-PL-Warszawa.7z -- Best regards, Andrzej

Hi Andrzej, thanks, that will help me. Gerd Date: Wed, 19 Mar 2014 17:20:23 +0100 From: popej@poczta.onet.pl To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways Hi Gerd,
Does anybody have a valid mp file that contains 4 node restrictions
here is attached a small sample with a restriction, this example comes from http://ump.waw.pl/en/index.html If you'd like to test a real piece of mp source, I have uploaded full region form UMP, it include img compiled by cgpsmapper: http://files.mkgmap.org.uk/download/185/UMP-PL-Warszawa.7z -- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi all, I am not sure how I should interpret a restriction relation with restriction=only_* and a via way. AFAIK the Garmin format doesn't have such kind of restriction, so we have to translate it into one or more no_* restrictions for the other possible ways. This was rather easy for restrictions with a via node, but how should I do it for via ways? Examples: http://www.openstreetmap.org/relation/67571 http://www.openstreetmap.org/relation/1745548 I assume I have to create a restriction that contains the node on the from way, the two nodes on the via way and finally any node that can be reached from the 2nd via node which doesn't lie on the to road. OK? I probably can code support for multiple via ways as Garmin seems to support that as well, but only if I find that in the OSM data. @Steve: Did you see anything in your original maps which might also be a only_* restriction? Gerd From: gpetermann_muenchen@hotmail.com To: mkgmap-dev@lists.mkgmap.org.uk Date: Wed, 19 Mar 2014 17:32:47 +0100 Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways Hi Andrzej, thanks, that will help me. Gerd Date: Wed, 19 Mar 2014 17:20:23 +0100 From: popej@poczta.onet.pl To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways Hi Gerd,
Does anybody have a valid mp file that contains 4 node restrictions
here is attached a small sample with a restriction, this example comes from http://ump.waw.pl/en/index.html If you'd like to test a real piece of mp source, I have uploaded full region form UMP, it include img compiled by cgpsmapper: http://files.mkgmap.org.uk/download/185/UMP-PL-Warszawa.7z -- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On Sun, Mar 23, 2014 at 09:52:53AM +0100, Gerd Petermann wrote:
I am not sure how I should interpret a restriction relation with restriction=only_* and a via way. AFAIK the Garmin format doesn't have such kind of restriction, so we have to translate it into one or more no_* restrictions for the other possible ways. This was rather easy for restrictions with a via node, but how should I do it for via ways? Examples: http://www.openstreetmap.org/relation/67571
This looks like a mapping error (should simply use a 'via' node).
This one is more tricky. The note on the relation says that there is a lane marking that you cannot cross when turning right from the parking lot. So, you can only continue straight to Mäkelänkatu and not take an immediate left turn to Vääksyntie. It seems that also this one could be corrected in the map data by branching the Vääksyntie exit before the parking lot driveway. In that case, there would be no need for a turn restriction. The real trouble (AFAICT) is no_u_turn with role=via ways. That cannot be fixed by manually simplifying the map data. Marko

Hi Marko, I don't care whether the restrictions could be changed in OSM. I just want to make sure that I translate them correctly we writing the img file. Gerd
Date: Sun, 23 Mar 2014 12:12:36 +0200 From: marko.makela@iki.fi To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways
On Sun, Mar 23, 2014 at 09:52:53AM +0100, Gerd Petermann wrote:
I am not sure how I should interpret a restriction relation with restriction=only_* and a via way. AFAIK the Garmin format doesn't have such kind of restriction, so we have to translate it into one or more no_* restrictions for the other possible ways. This was rather easy for restrictions with a via node, but how should I do it for via ways? Examples: http://www.openstreetmap.org/relation/67571
This looks like a mapping error (should simply use a 'via' node).
This one is more tricky.
The note on the relation says that there is a lane marking that you cannot cross when turning right from the parking lot. So, you can only continue straight to Mäkelänkatu and not take an immediate left turn to Vääksyntie.
It seems that also this one could be corrected in the map data by branching the Vääksyntie exit before the parking lot driveway. In that case, there would be no need for a turn restriction.
The real trouble (AFAICT) is no_u_turn with role=via ways. That cannot be fixed by manually simplifying the map data.
Marko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On Sun, Mar 23, 2014 at 11:16:51AM +0100, Gerd Petermann wrote:
I don't care whether the restrictions could be changed in OSM. I just want to make sure that I translate them correctly we writing the img file.
IMO, this is on the border of "garbage in, garbage out". If there are clear semantics of the role=via ways in turn restrictions that can be easily explained to a human or a computer, sure, they can be supported. It is a matter of finding balance of effort: will the implementation effort be smaller than the effort to map it in a simpler way? It also is a matter of risk: can the more complex translation rule fail the "do what I mean" semantics that the mapper might have had in mind. In the example of the only_right_turn restriction from the parking lot driveway, we could accidentally introduce an only_straight_on restriction to the main road (prohibiting any left turns). I think that we would need some kind of regression tests for turn restrictions, or routing in general. These examples can be fixed in the map data, and I plan to do so in the next few days. What cannot be fixed in the map data are no_u_turn restrictions on dual-oneways that use role=via ways. Marko

Hi Marko, I've created a new branch via_ways to support this. It is nearly done, but I have to find solutions for some edge cases like via ways that cross tile boundaries. Also some routines like RoadMerger are not yet fully tested. The current version prints a few error messages for these edge cases. Gerd
Date: Sun, 23 Mar 2014 17:23:41 +0200 From: marko.makela@iki.fi To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] Turn restrictions with role=via ways
On Sun, Mar 23, 2014 at 11:16:51AM +0100, Gerd Petermann wrote:
I don't care whether the restrictions could be changed in OSM. I just want to make sure that I translate them correctly we writing the img file.
IMO, this is on the border of "garbage in, garbage out". If there are clear semantics of the role=via ways in turn restrictions that can be easily explained to a human or a computer, sure, they can be supported. It is a matter of finding balance of effort: will the implementation effort be smaller than the effort to map it in a simpler way?
It also is a matter of risk: can the more complex translation rule fail the "do what I mean" semantics that the mapper might have had in mind. In the example of the only_right_turn restriction from the parking lot driveway, we could accidentally introduce an only_straight_on restriction to the main road (prohibiting any left turns). I think that we would need some kind of regression tests for turn restrictions, or routing in general.
These examples can be fixed in the map data, and I plan to do so in the next few days. What cannot be fixed in the map data are no_u_turn restrictions on dual-oneways that use role=via ways.
Marko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hallo Gerd, On Sun, Mar 23, 2014 at 06:16:27PM +0100, Gerd Petermann wrote:
I've created a new branch via_ways to support this. It is nearly done, but I have to find solutions for some edge cases like via ways that cross tile boundaries. Also some routines like RoadMerger are not yet fully tested.
OK, let me know when you would like some testing. FWIW, there were 4 relations with role=via ways that were not no_u_turn in Finland. I removed or replaced all of these today: $grep "'via' ways are not supported" mkgmap.log.0|grep -v no_u_turn 2014/03/24 15:25:06 WARNING (RestrictionRelation): 63240004.osm.pbf: Turn restriction http://www.openstreetmap.org/browse/relation/2640984 (at http://www.openstreetmap.org/?mlat=61.510688&mlon=23.777567&zoom=17) sorry, 'via' ways are not supported - ignoring restriction [type=restriction,restriction=no_left_turn] 2014/03/24 15:25:22 WARNING (RestrictionRelation): 63240002.osm.pbf: Turn restriction http://www.openstreetmap.org/browse/relation/1767298 (at http://www.openstreetmap.org/?mlat=60.206666&mlon=25.120266&zoom=17) sorry, 'via' ways are not supported - ignoring restriction [type=restriction,restriction=only_straight_on] 2014/03/24 15:25:22 WARNING (RestrictionRelation): 63240002.osm.pbf: Turn restriction http://www.openstreetmap.org/browse/relation/67571 (at http://www.openstreetmap.org/?mlat=60.168673&mlon=24.935049&zoom=17) sorry, 'via' ways are not supported - ignoring restriction [except=psv;bicycle,type=restriction,restriction=only_left_turn] 2014/03/24 15:25:22 WARNING (RestrictionRelation): 63240002.osm.pbf: Turn restriction http://www.openstreetmap.org/browse/relation/1745548 (at http://www.openstreetmap.org/?mlat=60.190691&mlon=24.962903&zoom=17) sorry, 'via' ways are not supported - ignoring restriction [type=restriction,restriction=only_right_turn] I got the list with this patch: Index: src/uk/me/parabola/mkgmap/reader/osm/RestrictionRelation.java =================================================================== --- src/uk/me/parabola/mkgmap/reader/osm/RestrictionRelation.java (revision 3116) +++ src/uk/me/parabola/mkgmap/reader/osm/RestrictionRelation.java (working copy) @@ -281,7 +281,7 @@ } if (result && viaWay != null) { - log.warn(messagePrefix + "sorry, 'via' ways are not supported - ignoring restriction"); + log.warn(messagePrefix + "sorry, 'via' ways are not supported - ignoring restriction " + toTagString()); result = false; } return result; IMO, a role=via way in anything else than restriction=no_u_turn is likely a mapping error. The fixes I applied: 2640984: Split the 'via' way, make the part of it oneway. It is an oneway link between dual oneway lines in a T crossing. After the fix, you cannot drive against the oneway direction, and the no_left_turn restriction becomes redundant. 1767298: Remove the restriction. It was redundant, as the other turning target was tagged with oneway=yes, prohibiting the turn. In fact, all the ways in the T-shaped crossing were tagged oneway=yes. 67571: Remove one of the ways, make the role=via way the role=from way, and add a role=via node. 1745548: Make the left-turning lane branch earlier, according to the lane markings that are visible in Bing imagery. No turn restriction is needed, because the oneway=yes takes care of it. BTW, while you are doing this, you could introduce warnings for redundant turn restriction relations (prohibiting turns against oneway direction). Best regards, Marko

Hi, cgpsmapper supports restrictions defined as 4 nodes and 3 roads. This is needed for most U-turn restriction, essential for roads with separated lanes. -- Best regards, Andrzej

Hi Andrzej, thanks, so we have a manual for that format :-) Gerd popej wrote
Hi,
cgpsmapper supports restrictions defined as 4 nodes and 3 roads. This is needed for most U-turn restriction, essential for roads with separated lanes.
-- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/Turn-restrictions-with-role-via-ways-tp579963... Sent from the Mkgmap Development mailing list archive at Nabble.com.
participants (5)
-
Andrzej Popowski
-
Gerd Petermann
-
GerdP
-
Marko Mäkelä
-
Steve Ratcliffe