Yes, second time around it's faster indeed :)
Great stuff, I love GraphHopper.
Some suggestions:
A) ghRequest.setWeighting("shortest") should fail fast:
it should throw an IllegalArgumentException as long as it's not
supported
B) I loaded a belgium osm.pbf with graphHopperLocation "belgium",
then, in another run, I loaded a UK osm.pbf with the same
graphHopperLocation (I forgot to change it).
It loaded immediately, pretending to be successful and then failed when
I queried for a UK location.
That loading should fail fast too (or refresh the graphHopperLocation
content to handle it correctly).
On 27-10-14 11:29, Peter wrote:
Interesting observation: shortestGraphHopper takes much longer to load
than fastestGraphHopper.
This is expected for 'import' but it should occur only for the first
time otherwise GH will just 'load' in the importOrLoad method.
(Also foot or bike take longer to import than car)
Regards,
Peter.
On 27.10.2014 11:06, Geoffrey De Smet wrote:
I didn't explicitly enable CH, but it's probably the default in
forServer().
Thanks to your feedback, I got it to work like this :)
fastestGraphHopper = new GraphHopper().forServer();
fastestGraphHopper.setOSMFile(osmPath);
fastestGraphHopper.setGraphHopperLocation("local/fastestGraphHopper");
fastestGraphHopper.setEncodingManager(new
EncodingManager(EncodingManager.CAR));
fastestGraphHopper.setCHShortcuts("fastest");
fastestGraphHopper.importOrLoad();
logger.info("fastestGraphHopper loaded.");
shortestGraphHopper = new GraphHopper().forServer();
shortestGraphHopper.setOSMFile(osmPath);
shortestGraphHopper.setGraphHopperLocation("local/shortestGraphHopper");
shortestGraphHopper.setEncodingManager(new
EncodingManager(EncodingManager.CAR));
shortestGraphHopper.setCHShortcuts("shortest");
shortestGraphHopper.importOrLoad();
logger.info("shortestGraphHopper loaded.");
Interesting observation: shortestGraphHopper takes much longer to load
than fastestGraphHopper.
On 24-10-14 18:51, Peter wrote:
Hi,
I think you are using GH with CH enabled, right? Then you cannot
specifiy this per request. You'll have to create one GraphHopper
instance per profile (until we fixed #111).
Regards,
Peter.
On 24.10.2014 10:24, Geoffrey De Smet wrote:
Between 2 locations I am asking GraphHopper for the quickest and the
fastest route,
but it's always the same.
I tried for every pair between 50 locations all over Belgium, so it's
very unlikely that they actually are the same.
Am I doing something wrong?
Here's the code I used:
GHRequest request = new GHRequest(fromLocation.getLatitude(),
fromLocation.getLongitude(),
toLocation.getLatitude(), toLocation.getLongitude())
.setVehicle("car");
request.setWeighting("shortest");
GHResponse response = graphHopper.route(request); // Quickest
GHRequest request2 = new GHRequest(fromLocation.getLatitude(),
fromLocation.getLongitude(),
toLocation.getLatitude(), toLocation.getLongitude())
.setVehicle("car");
GHResponse response2 = graphHopper.route(request2); // Fastest
if (response.getDistance() != response2.getDistance()) {
System.out.println("Differs"); // never happens.
}
_______________________________________________
GraphHopper mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/graphhopper
_______________________________________________
GraphHopper mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/graphhopper