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
{{ message }}
Repository navigation
Exception if speed is 0 but valid access flags and using shortest path algo. #242
If a speed of 0 is assigned without setting the proper access flags to the edge, then a shortest path is still taken through this edge (although 'blocked') and leading to negativ millis variable in Path object which causes an exception.
java.lang.RuntimeException: Time was negative. Please report as bug and include:...
at com.graphhopper.GraphHopper.getPaths(GraphHopper.java:885)
As this is a usage problem and shortest path weighting really should not need to read the speeds, we just report this issue in more detail when this happens in Path.calcMillis
changed the title [-]Exception if speed is 0 but valid access flags. Only problem for shortest path.[/-][+]Exception if speed is 0 but valid access flags and using shortest path algo.[/+]on Jan 14, 2015
I just ran into this again: This road https://www.openstreetmap.org/way/876442097 has a maxspeed=5 tag, so in CarTagParser we assign a speed of 0 km/h with the default speed bits configuration. This means that VehicleTagParser#setSpeed sets the access flag to false (but only for one direction?!). But directly afterwards in CarTagParser we set the access to true again, because of the oneway=yes tag.
I then got this exception when I used the shortest weighting:
Speed cannot be 0 for unblocked edge, use access properties to mark edge blocked! Should only occur for shortest path calculation. See #242.
a road tagged as maxspeed=5 should not be blocked for cars with the default configuration (?)
if speed_two_directions=false and the speed is so small that we decide to set the access to false we should do this for both directions?!
obviously we should not set the access back to true just because there is a oneway tag (after we decided it shall be blocked because of the low speed?)
a setSpeed method should not set access
speeds and access flags should not be intermixed in the first place?!
speeds and access flags should not be intermixed in the first place?!
Yeah, definitely a very important issue!
But how can it still happen that we use the edge if speed is 0 (if access is true)?
Because the case speed==0 is already handled in FastestWeighting and CustomWeighting.
a road tagged as maxspeed=5 should not be blocked for cars with the default configuration (?)
Yes. We could relax the current condition a bit and use <getSmallestNonZeroValue/2 instead of <getSmallestNonZeroValue like we did before? 3b67e2d
Activity
[-]Shortest path[/-][+]Exception if speed is 0 but valid access flags. Only problem for shortest path.[/+]karussell commentedon Jan 14, 2015
As this is a usage problem and shortest path weighting really should not need to read the speeds, we just report this issue in more detail when this happens in Path.calcMillis
[-]Exception if speed is 0 but valid access flags. Only problem for shortest path.[/-][+]Exception if speed is 0 but valid access flags and using shortest path algo.[/+]We get some edges with speed 0.0.
easbar commentedon Nov 9, 2022
I just ran into this again: This road https://www.openstreetmap.org/way/876442097 has a
maxspeed=5tag, so inCarTagParserwe assign a speed of 0 km/h with the default speed bits configuration. This means thatVehicleTagParser#setSpeedsets the access flag to false (but only for one direction?!). But directly afterwards inCarTagParserwe set the access totrueagain, because of theoneway=yestag.I then got this exception when I used the shortest weighting:
karussell commentedon Nov 9, 2022
Yeah, definitely a very important issue!
But how can it still happen that we use the edge if speed is 0 (if access is true)?
Because the case speed==0 is already handled in FastestWeighting and CustomWeighting.
Yes. We could relax the current condition a bit and use
<getSmallestNonZeroValue/2instead of<getSmallestNonZeroValuelike we did before? 3b67e2dotbutz commentedon Nov 9, 2022
@easbar mentioned the shortest weighting. Maybe it's still unpatched for that.
easbar commentedon Nov 9, 2022
Yes, or even just round up?
Yes, it only happened with the shortest weighting, but I did not inspect this further.