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
It is quite noticeable however, that unlike distance calculations - which are very accurate - the time calculations for routes are always underestimated.
I saw that in the function com.graphhopper.routing.Path.calcMillis() it is simply assumed that the driving on each edge occurs at a constant speed equal to the speed limit.
Even before accounting for traffic lights, stop signs, etc. this can be much improved by simply adding acceleration and deceleration phases around each turn, and by imposing some rigid bound on the vehicle speed when making the turn.
Is this planned for the near future?
If not, it would be nice to leave a hook (or allow subclassing) for substituting the default calculation of the millis with a custom one.
Correct me if I'm wrong, but changing the weighting affects how the best route is assembled, but doesn't change the value returned by Path.getMillis() or GHResponse.getMillis(), doesn't it?
Indeed, currently there is no way to change this calculation in a post-processing step. The turn calculation is also currently not used to influence this time. We can think about something like that but before we fix other problems like #230
I took your advice for now, although I think it would be best to account for slowdown factors (turning time, stop signs and traffic lights) in the getMillis() functions. What I did is simply reducing the estimated speed on all edges, and now I'm getting more realistic results.
// can be used with CarFlagEncoder instead; requires rebuild of the graph db
final MotorcycleFlagEncoder slowerMotorcycleEncoder = new MotorcycleFlagEncoder("speedBits=6|speedFactor=2")
{
private static final double SLOWDOWN_FACTOR = 0.55;
@Override
public long handleWayTags(OSMWay way, long allowed, long relationFlags)
{
long encoded = super.handleWayTags(way, allowed, relationFlags);
encoded = setSpeed(encoded, getSpeed(encoded) * SLOWDOWN_FACTOR);
encoded = setReverseSpeed(encoded, getReverseSpeed(encoded) * SLOWDOWN_FACTOR);
return encoded;
}
};
final GraphHopper gh = new GraphHopper()
.setEncodingManager(new EncodingManager(slowerMotorcycleEncoder))
...
;
not sure what you're asking here.. you can take any two points and compare GraphHopper's estimate with Google's (who would also give you an estimate in a trafiic-less scenario - which, I think, is what GraphHopper should aim for).
So far the all-across slowdown factor of 0.55 proved very efficient for me with in-city, day-time routes.
Activity
karussell commentedon Feb 18, 2015
Not really, as we already reduce the maxspeed which has similar effects although of course not the same. This will be improved mainly via #230
karussell commentedon Feb 18, 2015
You can already hook into this calculation easily: https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md
zach-m commentedon Feb 18, 2015
Correct me if I'm wrong, but changing the weighting affects how the best route is assembled, but doesn't change the value returned by Path.getMillis() or GHResponse.getMillis(), doesn't it?
karussell commentedon Feb 18, 2015
Ups, my fault!
Indeed, currently there is no way to change this calculation in a post-processing step. The turn calculation is also currently not used to influence this time. We can think about something like that but before we fix other problems like #230
karussell commentedon Feb 18, 2015
What you can do as a workaround for cities (as I see from your repo :)) is that you can reduce the default speeds. E.g. for car: https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/util/CarFlagEncoder.java#L104
zach-m commentedon Feb 23, 2015
I took your advice for now, although I think it would be best to account for slowdown factors (turning time, stop signs and traffic lights) in the
getMillis()functions. What I did is simply reducing the estimated speed on all edges, and now I'm getting more realistic results.karussell commentedon Mar 24, 2015
Hey, would you mind to add 2 or 3 expected times (e.g. from your experience) with graphhopper maps links?
[-]Time estimates for routes are unrealistic[/-][+]Take slowdown and accelerating into account[/+]zach-m commentedon Mar 25, 2015
not sure what you're asking here.. you can take any two points and compare GraphHopper's estimate with Google's (who would also give you an estimate in a trafiic-less scenario - which, I think, is what GraphHopper should aim for).
So far the all-across slowdown factor of 0.55 proved very efficient for me with in-city, day-time routes.