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
If you use the motorcycle profile and the curvature weighting and read an OSM way with a low maxspeed, for example maxspeed=2, the speed of the edge will be 0. An example way can be found here.
java.lang.IllegalStateException: Calculating time should not require to read speed from edge in wrong direction. Reverse:false, fwd:false, bwd:false
at com.graphhopper.routing.weighting.AbstractWeighting.calcMillis(AbstractWeighting.java:44)
at com.graphhopper.routing.weighting.FastestWeighting.calcMillis(FastestWeighting.java:83)
at com.graphhopper.routing.Path.processEdge(Path.java:242)
When I think about this a bit more: this is kind of expected as we set access to false for speed==0 and so if speed is rounded downwards the result can be access==false. The only other solution would be a different rounding strategy if close to 0. But having speed==0 and access==true does not make sense.
This is a more general problem that we always had problems with.
For motorcycle we could solve it consistent: we could make the access-check dependent on speed==0 and do not use separate access bits as we have one speed value for every direction.
But for other vehicles like car or foot we only want to use speedBits+2 instead speedBits*2 and so we need two separate access bits.
In the latest branch #1447 we could try to solve this via creating a special "combined" speed+access EncodedValue that handles this on the lowest level and switches to speedBits*2 without any access bits if the speed value should be stored for both directions.
update: I've tried to implement this combined EncodedValue and it is a very tricky thing. The only consistent solution is to forbid setting access flags explicitly in both cases and influence access only via setting speed to 0. But then we would solve this problem only for fastest weighting. What if there is a more complicated weighting (v/s+time_offset) or just shortest where we need separate access values as we cannot change the distance to 0. Maybe an EdgeFilter using the Weighting similar to #729 would help.
This can still happen but only if the speed is extremely small. Closing for now as it can be avoided if the code is moved into a custom model and then the value does not have to be stored in an encoded value.
Activity
karussell commentedon Dec 4, 2017
When I think about this a bit more: this is kind of expected as we set access to false for speed==0 and so if speed is rounded downwards the result can be access==false. The only other solution would be a different rounding strategy if close to 0. But having speed==0 and access==true does not make sense.
karussell commentedon Dec 4, 2017
But the question is why there is a path going through if access==false for both directions.
boldtrn commentedon Dec 4, 2017
I think I found the issue here. The CurvatureWeighting has no clause
if(speed==0) return Double.POSITIVE_INFINITIVE.karussell commentedon Sep 10, 2018
This is a more general problem that we always had problems with.
For motorcycle we could solve it consistent: we could make the access-check dependent on speed==0 and do not use separate access bits as we have one speed value for every direction.
But for other vehicles like car or foot we only want to use
speedBits+2insteadspeedBits*2and so we need two separate access bits.In the latest branch #1447 we could try to solve this via creating a special "combined" speed+access EncodedValue that handles this on the lowest level and switches to
speedBits*2without any access bits if the speed value should be stored for both directions.update: I've tried to implement this combined EncodedValue and it is a very tricky thing. The only consistent solution is to forbid setting access flags explicitly in both cases and influence access only via setting speed to 0. But then we would solve this problem only for
fastestweighting. What if there is a more complicated weighting (v/s+time_offset) or justshortestwhere we need separate access values as we cannot change the distance to 0. Maybe an EdgeFilter using the Weighting similar to #729 would help.[-]Speed is 0 for low speed edges using motorcycle[/-][+]Speed is 0 for low speed edges[/+]karussell commentedon Mar 27, 2023
This can still happen but only if the speed is extremely small. Closing for now as it can be avoided if the code is moved into a custom model and then the value does not have to be stored in an encoded value.