Hello!
first of all: thank you for this incredible project!
I am struggeling with understanding the Java-Client for routing. When using the GH Rest-API I receive different values for time and weight compared to my local setup.
The propossed time and weight of the (best) path is always lower compared to the routes produced by the GH Rest-API.
Here my cut-down code:
GraphHopper hopper = new GraphHopperOSM().forServer();
hopper.setGraphHopperLocation("andorra");
// downloaded from https://download.geofabrik.de/europe/andorra-latest.osm.pbf
hopper.setDataReaderFile("andorra/andorra-latest.osm.pbf");
hopper.setEncodingManager(EncodingManager.create("car"));
hopper.importOrLoad();
GHRequest ghRequest =
new GHRequest(42.504482, 1.522286, 42.51295, 1.531134)
.setWeighting("fastest")
.setVehicle("car")
.setLocale(Locale.GERMAN);
GHResponse route = hopper.route(ghRequest);
System.out.println("time: " + route.getBest().getTime());
System.out.println("weight: " + route.getBest().getRouteWeight());
// produces
// time: 180352
// weight: 180.3628508546962
// using GH API
// curl
// https://graphhopper.com/api/1/route?point=42.504482,1.522286&weighting=fastest&point=42.51295,1.531134&vehicle=car&locale=de&key=API_KEY
// produces
// time:198905
// weight:224.663948
I also tried to disable CH and use “shortest” weighting but this does not change the result much.
Can someone help with my setup?