[GraphHopper] No difference between shortest and fastest

Geoffrey De Smet ge0ffrey.spam at gmail.com
Fri Oct 24 08:24:33 UTC 2014


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.
         }




More information about the GraphHopper mailing list