[PATCH v2] Advanced restrictions

Hello, So my post from a couple weeks ago was correct. You can have turn restrictions with via ways. Attached is a patch that does that and also implements the "More restriction exceptions <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q2/008330.html>" I posted yesterday. I'd like to warn that this was a quite complex thing and I did not fully understand the relation structure in mkgmap so it may break other thinks. I needs to be reviewed by s.o. who knows how restriction relation works in mkgmap. It has limitations as well: * If the via ways gets split for routing (like in http://www.openstreetmap.org/browse/relation/275622 where via way http://www.openstreetmap.org/browse/way/41694496 gets split at http://www.openstreetmap.org/browse/node/62547613 because of an incoming ramp), the relation creation fails * I did not try with more than one via way but it probably just fails as well Those again would need to be looked at by s.o. with better knowledge of how routing and restrictions works. Thanks, N.

Thanks Nakor! I hope Felix and others can give it some testing with various versions of MapSource and different GPS receivers. This would help me get rid of these 21 warnings in Finland: On Thu, May 13, 2010 at 08:49:17PM -0400, Nakor wrote:
@@ -262,17 +271,17 @@ result = false; }
- if (result && viaWay != null) { + /*if (result && viaWay != null) { log.warn(messagePrefix + "sorry, 'via' ways are not supported - ignoring restriction"); result = false; - } + }*/
return result; }
Come on, don't be shy to just remove those lines rather than commenting them out. Removed code can always be fetched from the repository if needed. Best regards, Marko

I don't really understand/see the need for the patch yet. I use --ignore-turn-restrictions when creating any maps currently. You can't have one map to have both good autorouting in a motorcar, and on bicycle or foot, as we can't encode different road_speed road_priority based on vehicle type. As long as there is no answer to different road_speed / road_priority I don't think vehicle dependant hardcoded turn restrictions help a lot. What would be much more needed, is a new pedestrian turns restriction, and bicycle turn resctriction dataset in OSM, with the default assumption that both bicycles and pedestrian can turn everywhere. Once a data model for how to encode this in OSM exists (I have not seen any yet), the above patch could be useful to generally allow any turn for emergency, bicycle and pedestrian, except where specific restrictions are given. Is this patch also able to have dependant on vehicle different avoid toll and avoid unpaved road settings? If so then it gets interesting and I might find some use for it. On the other hand, turn restrictions in general don't bother me much as a cyclist/mtbiker/hiker. Oh and one more subtle question, are the additional exceptions increasing file size? And if so how much? (say disable all turn restrictions for pedestrian/emergency - by how much does overall file size on country X increase for the default style?)

On 5/14/2010 6:17 AM, Felix Hartmann wrote:
I don't really understand/see the need for the patch yet.
[...]
Felix, There is two different thing here. The first thing (posted Wednesday night) is adding emergency and pedestrian turn exceptions. Disabling emergency and/or pedestrian systematically is two bits in an existing byte so it will not change the size. Disabling other types of vehicle on a systematic manner, would increase one byte per restriction. Depending on usage it can be interesting: I personally use my car map for short ped routing and would love to be able to disable turn restrictions in that case. The second one (posted Thursday evening) is much more interesting and allows via ways in restrictions. Has I said yesterday there are some know issues mainly because I did not get the full extent of the NOD file encoding. One thing that I forgot yesterday is that the turn restrictions are duplicated for now. I guess some sort of logic would allow to keep only one version of each of such restrictions. Regarding your suggestions of toll roads and others depending on vehicle type, I do not know if this is possible at this time. Thanks, N.

On 14.05.2010 13:24, Nakor wrote:
On 5/14/2010 6:17 AM, Felix Hartmann wrote:
I don't really understand/see the need for the patch yet.
[...]
Felix,
There is two different thing here.
The first thing (posted Wednesday night) is adding emergency and pedestrian turn exceptions. Disabling emergency and/or pedestrian systematically is two bits in an existing byte so it will not change the size. Disabling other types of vehicle on a systematic manner, would increase one byte per restriction. Depending on usage it can be interesting: I personally use my car map for short ped routing and would love to be able to disable turn restrictions in that case.
The second one (posted Thursday evening) is much more interesting and allows via ways in restrictions. Has I said yesterday there are some know issues mainly because I did not get the full extent of the NOD file encoding. One thing that I forgot yesterday is that the turn restrictions are duplicated for now. I guess some sort of logic would allow to keep only one version of each of such restrictions.
What are via ways in restrictions? Could you give some practical example of what they do and what they are needed for? Would they increase the maximal routing distance? Or maybe it the fact that they are missing the reason for our intertilerouting in Mapsource which is not working correctly?
Regarding your suggestions of toll roads and others depending on vehicle type, I do not know if this is possible at this time.
Thanks,
N.
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On Fri, May 14, 2010 at 01:27:59PM +0200, Felix Hartmann wrote:
What are via ways in restrictions? Could you give some practical example of what they do and what they are needed for?
When there is a junction of two highways that are both mapped as two parallel oneways, the "via" of turn restrictions will not be a node but one of the four two-node lines (an edge of the "square") at the crossing.
Would they increase the maximal routing distance? Or maybe it the fact that they are missing the reason for our intertilerouting in Mapsource which is not working correctly?
As far as I understand, mkgmap currently ignores turn restrictions where the via member is not a node. My guess is that obeying turn restrictions could decrease the maximal routing distance, not increase it. Marko (who uses a "car" (default) map for pedestrian and bicycle routing)

On 5/14/2010 7:27 AM, Felix Hartmann wrote:
What are via ways in restrictions? Could you give some practical example of what they do and what they are needed for?
Please see http://lists.openstreetmap.org/pipermail/talk-us/2010-May/003218.html . Thanks, N.

On 14.05.2010 13:42, Nakor wrote:
On 5/14/2010 7:27 AM, Felix Hartmann wrote:
What are via ways in restrictions? Could you give some practical example of what they do and what they are needed for?
Please see http://lists.openstreetmap.org/pipermail/talk-us/2010-May/003218.html .
Thanks,
N. So if I understand correctly in the linked example. Cars originating from M10 (from the south) are allowed to exit M10 to Milwaukee Street. Cars originating from I-94 (coming from the west) are not allowed to exit M10 to Milwaukee Street? (so I assume there are several lanes, and you're maybe only allowed to cross lanes to the left, but not to the right (or the other way round), and the limit to cross lanes is so long intact that you miss the exit, correct?
It's a little bit like some speed restrictions in Austria that only apply if you arrive from Street X. Everyone not arriving from Street X may drive faster (yes it's crazy, but we have quite a lot of places where this takes place, and even gets executed).

What are via ways in restrictions? Could you give some practical example of what they do and what they are needed for?
Would they increase the maximal routing distance? Or maybe it the fact that they are missing the reason for our intertilerouting in Mapsource which is not working correctly?
This is something I brought up a while ago. Consider the following A B C --------+-------> | <-------+-------- D E| F | \/ G ABC is oneway in direction ABC FED is oneway in direction FED BE is twoway but is marked with direction BE U turns are not allowed for FEBC nor are they allowed for ABED but all other turn are allowed In this situation the "via way" is BE and you create a no_u_turn trstriction from FE, to BC, via BE. Up until now mkgmap would ignore this restriction as it couldn't handle it. There are loads of these near me and I suspect in many other places as well Cheers Paul

On Fri, May 14, 2010 at 04:51:21PM +0100, Paul wrote:
What are via ways in restrictions? Could you give some practical example of what they do and what they are needed for?
Would they increase the maximal routing distance? Or maybe it the fact that they are missing the reason for our intertilerouting in Mapsource which is not working correctly?
This is something I brought up a while ago. Consider the following
A B C --------+-------> | <-------+-------- D E| F | \/ G ABC is oneway in direction ABC FED is oneway in direction FED BE is twoway but is marked with direction BE U turns are not allowed for FEBC nor are they allowed for ABED but all other turn are allowed
In this situation the "via way" is BE and you create a no_u_turn trstriction from FE, to BC, via BE. Up until now mkgmap would ignore this restriction as it couldn't handle it.
There are loads of these near me and I suspect in many other places as well
Sure, every place where there is a major road that is mapped as two antiparallel oneways. Usually U turns and across-the-ongoing-traffic turns would be prohibited, and the 'via' would be a two-node way, not a node. Marko

On 14/05/10 01:49, Nakor wrote:
Hello,
So my post from a couple weeks ago was correct. You can have turn restrictions with via ways. Attached is a patch that does that and also implements the "More restriction exceptions <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q2/008330.html>" I posted yesterday.
I'll give it a test over the next couple of days Cheers Paul

On 14/05/10 01:49, Nakor wrote:
Hello,
So my post from a couple weeks ago was correct. You can have turn restrictions with via ways. Attached is a patch that does that and also implements the "More restriction exceptions <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q2/008330.html>" I posted yesterday.
Sorry. Got the following when trying to patch the latest mkgmap from svn. Do you have a pre-complied version I could download Cheers Paul patch -p1 < ../more_restriction_exceptions_2.patch (Stripping trailing CRs from patch.) patching file me/parabola/imgfmt/app/net/RouteRestriction.java Hunk #1 FAILED at 14. Hunk #2 FAILED at 35. Hunk #3 FAILED at 57. Hunk #4 FAILED at 72. Hunk #5 FAILED at 93. Hunk #6 FAILED at 146. 6 out of 6 hunks FAILED -- saving rejects to file me/parabola/imgfmt/app/net/RouteRestriction.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/general/MapCollector.java Hunk #1 FAILED at 16. Hunk #2 FAILED at 72. 2 out of 2 hunks FAILED -- saving rejects to file me/parabola/mkgmap/general/MapCollector.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/general/MapDetails.java Hunk #1 FAILED at 115. 1 out of 1 hunk FAILED -- saving rejects to file me/parabola/mkgmap/general/MapDetails.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/general/RoadNetwork.java Hunk #1 FAILED at 264. 1 out of 1 hunk FAILED -- saving rejects to file me/parabola/mkgmap/general/RoadNetwork.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/main/StyleTester.java Hunk #1 FAILED at 716. Hunk #2 FAILED at 758. 2 out of 2 hunks FAILED -- saving rejects to file me/parabola/mkgmap/main/StyleTester.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/osmstyle/StyledConverter.java Hunk #1 FAILED at 468. 1 out of 1 hunk FAILED -- saving rejects to file me/parabola/mkgmap/osmstyle/StyledConverter.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/reader/osm/RestrictionRelation.java Hunk #1 FAILED at 24. Hunk #2 FAILED at 55. Hunk #3 FAILED at 92. Hunk #4 FAILED at 148. Hunk #5 FAILED at 166. Hunk #6 FAILED at 187. Hunk #7 FAILED at 213. Hunk #8 FAILED at 230. Hunk #9 FAILED at 262. Hunk #10 FAILED at 282. Hunk #11 FAILED at 297. Hunk #12 FAILED at 312. 12 out of 12 hunks FAILED -- saving rejects to file me/parabola/mkgmap/reader/osm/RestrictionRelation.java.rej (Stripping trailing CRs from patch.) patching file me/parabola/mkgmap/reader/overview/OverviewMapDataSource.java Hunk #1 FAILED at 18. Hunk #2 FAILED at 140. 2 out of 2 hunks FAILED -- saving rejects to file me/parabola/mkgmap/reader/overview/OverviewMapDataSource.java.rej
participants (4)
-
Felix Hartmann
-
Marko Mäkelä
-
Nakor
-
Paul