Repository navigation
Conversation
karussell
left a comment
There was a problem hiding this comment.
Thanks for your pull request!
| return 100; | ||
| return 50; | ||
| case LIVING_STREET: | ||
| return 4; |
There was a problem hiding this comment.
This does not look right. My understanding of the spatial rules was that they mirror the laws a country has regarding the maximum default speed. But 50km/h is only required inner city. Did you analyse the underlying cause why you had to change this?
There was a problem hiding this comment.
The SpatialRule acts as a fallback here. We don't know if we're in urban area or not so we have to go with the more defensive assumption that we are.
Otherwise things like #2266 happen: The routing prefers an urban residential road as the maxspeed fallback is 100km/h which is higher than the 70km/h of the B85. The routing acts accordingly and favors a detour.
There was a problem hiding this comment.
Hm, this sounds not the way to go. A spatial rule should stay like we defined and be identical to the local laws. If we mix in ETA improvements already here it won't work in the long term. So this PR is surely a step forward but we likely need to start with the ETA improvements before.
There was a problem hiding this comment.
A spatial rule should stay like we defined and be identical to the local laws.
I agree but the law clearly differentiates between urban and non-urban speed limits. Using 100km/h as the fallback for all residential roads is a clear violation of the law for most urban areas.
There was a problem hiding this comment.
I see what you mean but then we need to expand the spatial rules to support inner and outer city limits. But IMO this is a bigger undertaking that we need to plan a bit. E.g. the first step would be to identify from OSM and other sources where "inner city" is, from there we could populate an encoded value inner_city and finally apply the correct rural or urban spatial rule.
For the first step we should be able to use vector data (define our own areas or grab data from OSM) and raster data (using e.g. satellite imagery).
There was a problem hiding this comment.
Right now, SpatialRules are in a Schrödinger's cat situation: they are both right and wrong depending on which road segment they handle. I agree that we should add the distinction to GH at some point in the future, but for now, defaulting to the lower boundaries is a workable solution.
| if (maxSpeed == MaxSpeed.UNSET_SPEED) { | ||
| return Double.NaN; |
There was a problem hiding this comment.
Should we refactor the code so that it always use MaxSpeed.UNSET_SPEED instead of two "magic" values?
There was a problem hiding this comment.
A bit unsure about it as MaxSpeed.UNSET_SPEED is rather specific to our encoding and the rest of the logic rolls with NaN which is IMHO a better representation of an unknown value. I'd rather see the default value of the MaxSpeed changed to NaN.
|
Can we somehow introduce this "single max_speed parsing" without changing the country rules for now? |
|
Ultimately we need to untangle this thicket of default values and derived ones from maximum values. To summarize our current approach for routing:
This leads to a few quirks:
We could gut the CountryRules, remove My proposal would be to replace |
I'd like to see the current VehicleTagParsers split into (vehicle) access and speed parsers. With this in place the speed parsers could use a country rule method that modifies the (global) speed in a country-specific way, just like the other country rule methods modify some encoded value in a country-specific way. Ok, splitting the vehicle parsers into access and speed is probably not absolutely necessary for this, but since this needs to be done anyway... |
|
Shall we close here or can you update to master? (also can you avoid changing the spatial rules -> see #2810) |
|
Let's close this one and see how things turn out with #2810, which should solve the gist of the problems described in #2268 (comment). |
Fixes #2266