You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now I'm planning for a roadtrip next summer, Graphhopper so far has been by far the best tool for this that I found. This route will take us through Norway which has lots of roads only open in the summer. Since I'm planning for the summer, this isn't a problem but I'm making this route in a season in which those roads are closed, and thus Graphhopper refuses to calculate routes on those roads. It makes it hard to plan months in advance as the route as I make it now will look different when we are actually driving it.
I'd like an option to ignore seasonal restrictions and just route over such a road, no matter what season I'm in.
Instead of following the road straight down south from the start, it goes up north instead and drives all the way around. If you however do the same route in the summer, it follows the route down south just fine.
The biggest question is the detail level we can or want to provide if we add an encoded value for this.
Conditional access rules can be arbitrarily complex. For your route it's a rather tame example: access:conditional=no @ (Nov-May) but things can get quite messy: motor_vehicle:conditional=delivery @ (Mo-Fr 06:00-11:00,17:00-19:00;Sa 03:30-19:00)
For time based rules we'd also need to resolve the applicable timezone...
Parsing those rules is messy, but has been done to some level of detail. We could dig out the code. Question is what happens then.
Do we evaluate the rules at import time, and say, when you import in summer, you get a summer graph? That's easy. (And, apparently, we're doing this, given the OP.)
Do we evaluate them at query time, so the user specifies a calendar date for which the route is going to be planned? That doesn't work with pre-preparation of any kind -- you would need one profile per day basically, as restrictions overlap, and Landmarks deteriorate surprisingly badly.
With finer grained restrictions (time of day) it's even worse, also because "real" time-dependent routing (where the clock moves forward as you go) is a different thing altogether.
We looked into algorithmic possibilities, and there's some code, and it totally works. (And it's easy and correct with plain Dijkstra anyway. Tricky thing is getting it fast.)
But my conclusion back then was that this is something for hand-built, curated scenarios (for a region, or with two or three hand-picked "seasons"), and we could (in principle, given resources) maintain the tools for this. But supporting this as a world-wide feature in full generality is not practical at the moment. (For us. Our particular codebase and our particular resources.)
(That was for @otbutz, about following all the rules for the given planning day. I think OP just had a switch in mind where you can say "ignore seasonal restrictions". That's easy of course.)
I think OP just had a switch in mind where you can say "ignore seasonal restrictions".
Yes I did 😉 Time of day access is of course way more complex and not something I'm personally interested in. I was just thinking of being able to set a date the route is being planned in, and then it'll use the seasonal restrictions of that date. Of course if a route takes e.g. 3 days to complete, that 3rd day might be in another season causing new road restrictions, but that is again more complex than I personally need.
But a switch to just ignore seasonal restrictions entirely would also work completely fine for me.
Yeah. Remaining question is where do we do that. Like, do we want this for our own API? Or as a feature for the open source version? If the latter, should it be enabled by default? If so, which features do we enable by default so that the encoded attributes don't stack up?
I am not very happy with the concept that the determined value is dependent on the import time. This might be perfectly fine for the GH project as the graph is updated frequently. For users who like to plan their routes in advance like OP or others who reimport their graph not that frequently, the routing might be off.
My proposal: just mark them as seasonal true/false if their conditional access is based on months. Ideally we should use this information for the instructions and to allow them to be used in custom profiles.
I think two pull requests should be enough to get a much better state than now:
feed a seasonal_restricted encoded value instead of blocking the access. I.e. other conditional access restrictions (full date with year) for e.g. constructions should be still done to the car_access etc for now.
This way clients can easily create a custom model to create the situation as it is now and enable or disable seasonal access.
And furthermore due to the second pull request there is more information for the user and it is easier to judge for them how dangerous this is.
We would need a 12bit EV to encode the months as a bitset.
Storing two bytes in the KVStorage will be soon also possible (see again #2598). But not sure if this is necessary and currently this is not intended and not tried for routing purposes within a Weighting.
I am not very happy with the concept that the determined value is dependent on the import time.
We already block roads dependent on the import time and I do not think that introducing this would make this worse.
The seasonal MTB route is tagged with bicycle:conditional=yes @(Apr-Oct) - but there is also vehicle=no specified -- so to really be useful in the sense of this issue, the conditional would have to be converted to unconditional upfront?
Activity
karussell commentedon Nov 23, 2021
Yeah, we should probably lift those restrictions and put this in a special encoded value so that one can still exclude this. Related to #1260.
Do you have a specific example?
PureTryOut commentedon Nov 23, 2021
Yes, for example https://graphhopper.com/maps/?point=62.082391%2C7.227845&point=61.939839%2C7.261105&point=62.015004%2C7.647686&locale=en-us&elevation=true&profile=car&use_miles=false&selected_detail=Elevation&layer=Omniscale
Instead of following the road straight down south from the start, it goes up north instead and drives all the way around. If you however do the same route in the summer, it follows the route down south just fine.
otbutz commentedon Nov 29, 2021
The biggest question is the detail level we can or want to provide if we add an encoded value for this.
Conditional access rules can be arbitrarily complex. For your route it's a rather tame example:
access:conditional=no @ (Nov-May)but things can get quite messy:motor_vehicle:conditional=delivery @ (Mo-Fr 06:00-11:00,17:00-19:00;Sa 03:30-19:00)For time based rules we'd also need to resolve the applicable timezone...
michaz commentedon Nov 29, 2021
We researched this extensively. Some of us might remember.
Parsing those rules is messy, but has been done to some level of detail. We could dig out the code. Question is what happens then.
Do we evaluate the rules at import time, and say, when you import in summer, you get a summer graph? That's easy. (And, apparently, we're doing this, given the OP.)
Do we evaluate them at query time, so the user specifies a calendar date for which the route is going to be planned? That doesn't work with pre-preparation of any kind -- you would need one profile per day basically, as restrictions overlap, and Landmarks deteriorate surprisingly badly.
With finer grained restrictions (time of day) it's even worse, also because "real" time-dependent routing (where the clock moves forward as you go) is a different thing altogether.
We looked into algorithmic possibilities, and there's some code, and it totally works. (And it's easy and correct with plain Dijkstra anyway. Tricky thing is getting it fast.)
But my conclusion back then was that this is something for hand-built, curated scenarios (for a region, or with two or three hand-picked "seasons"), and we could (in principle, given resources) maintain the tools for this. But supporting this as a world-wide feature in full generality is not practical at the moment. (For us. Our particular codebase and our particular resources.)
(That was for @otbutz, about following all the rules for the given planning day. I think OP just had a switch in mind where you can say "ignore seasonal restrictions". That's easy of course.)
PureTryOut commentedon Nov 29, 2021
Yes I did 😉 Time of day access is of course way more complex and not something I'm personally interested in. I was just thinking of being able to set a date the route is being planned in, and then it'll use the seasonal restrictions of that date. Of course if a route takes e.g. 3 days to complete, that 3rd day might be in another season causing new road restrictions, but that is again more complex than I personally need.
But a switch to just ignore seasonal restrictions entirely would also work completely fine for me.
otbutz commentedon Nov 30, 2021
We would need a 12bit EV to encode the months as a bitset. Seasons are a regional thing, so we can't use something like
Season.WINTER.karussell commentedon Nov 30, 2021
We could use a value with a single bit that just says this is a "currently active recurring restriction" (current==at import time):
michaz commentedon Nov 30, 2021
Yeah. Remaining question is where do we do that. Like, do we want this for our own API? Or as a feature for the open source version? If the latter, should it be enabled by default? If so, which features do we enable by default so that the encoded attributes don't stack up?
Etc.
otbutz commentedon Nov 30, 2021
I am not very happy with the concept that the determined value is dependent on the import time. This might be perfectly fine for the GH project as the graph is updated frequently. For users who like to plan their routes in advance like OP or others who reimport their graph not that frequently, the routing might be off.
My proposal: just mark them as seasonal true/false if their conditional access is based on months. Ideally we should use this information for the instructions and to allow them to be used in custom profiles.
karussell commentedon Jun 29, 2022
I think two pull requests should be enough to get a much better state than now:
seasonal_restrictedencoded value instead of blocking the access. I.e. other conditional access restrictions (full date with year) for e.g. constructions should be still done to the car_access etc for now.This way clients can easily create a custom model to create the situation as it is now and enable or disable seasonal access.
And furthermore due to the second pull request there is more information for the user and it is easier to judge for them how dangerous this is.
Storing two bytes in the KVStorage will be soon also possible (see again #2598). But not sure if this is necessary and currently this is not intended and not tried for routing purposes within a Weighting.
We already block roads dependent on the import time and I do not think that introducing this would make this worse.
remove conditional tag handling as it is bad for certain situations #…
Implementation for seasonal_restricted encoded value as suggested in g…
feed conditional restrictions as key+value pair as suggested in graph…
Make conditional access restrictions configurable (#2863)
hungerburg commentedon Mar 14, 2024
Will this also work here - https://graphhopper.com/maps/?point=47.169297%2C11.464763&point=47.176746%2C11.503031&profile=bike&layer=TF+Cycle
The seasonal MTB route is tagged with bicycle:conditional=yes @(Apr-Oct) - but there is also vehicle=no specified -- so to really be useful in the sense of this issue, the conditional would have to be converted to unconditional upfront?
karussell commentedon Mar 15, 2024
Unfortunately the default kicks in and makes this inaccessible. Will think if we should try to "negate" such a condition.
hungerburg commentedon Mar 15, 2024
There is also a gate https://www.openstreetmap.org/node/1640506593 there - might that cause the detour?