I am using graphopper routing engine for bike routing and I got surprised with some results. I was evaluating the duration and the distance of the route with different weighting and I found that the “shortest” route is faster than the “fastest” route. I am using this code:
GraphHopper hopper = new GraphHopperOSM().forServer();
hopper.getCHPreparationHandler().isDisablingAllowed();
hopper.setDataReaderFile("sachsen-anhalt-latest.osm.pbf");
// where to store graphhopper files?
hopper.setGraphHopperLocation("graphFolder");
hopper.setEncodingManager(EncodingManager.create("bike"));
hopper.importOrLoad();
double latFrom=52.119414;
double lonFrom=11.627536;
double lonTo=11.653850;
double latTo=52.142014;
`// simple configuration of the request object, see the GraphHopperServlet classs for more possibilities.
GHRequest req = new GHRequest(latFrom, lonFrom, latTo, lonTo).
setWeighting("fastest").
setVehicle("bike").
setLocale(Locale.GERMANY);
GHResponse rsp = hopper.route(req);
// first check for errors
if(rsp.hasErrors()) {
// handle them!
// rsp.getErrors()
return;
}
// use the best path, see the GHResponse class for more possibilities.
PathWrapper path = rsp.getBest();
// points, distance in meters and time in millis of the full path
PointList pointList = path.getPoints();
double distance = path.getDistance();
long timeInMs = path.getTime();`
For these coordinates, using the fastest path, I got the following results: distance is: 3719.9744845032633 duration :794923
and using the shortest path, I got: distance is: 3406.465484503264 duration :770216
and using the short_fastest I get the best results for the duration: distance is: 3418.522484503264 duration :691584
Is there any explanation ?