request.setVehicle(vehicleStr). setWeighting(weighting). setAlgorithm(algoStr).
GHRequest req = new GHRequest(fromLat, fromLon, toLat, toLon). setWeighting("fastest"). setVehicle(vehicle);
GHRequest sodReq = new GHRequest(fromLat, fromLon, toLat, toLon). setWeighting("fastest"). setVehicle(vehicle). setAlgorithm(DIJKSTRA_BI); setVehicle(vehicle). setAlgorithm(DIJKSTRA_BI); noSodReq.getHints().put("stall_on_demand", false);
GHRequest req = new GHRequest(fromLat, fromLon, toLat, toLon). setWeighting("fastest"). setVehicle(vehicle). setAlgorithm(algo);
if (vehicle.isEmpty()) { vehicle = getDefaultVehicle().toString(); request.setVehicle(vehicle);
public GHResponse getResponse(GHPoint from, GHPoint to) { // The flag encoder's toString method returns the vehicle type GHRequest req = new GHRequest(from, to).setVehicle(flagEncoder.toString()); GHResponse rsp = hopper.route(req); if (rsp.hasErrors()) { return null; } return rsp; }
public RoutingResult getRouteBetween(NavigationPosition from, NavigationPosition to, TravelMode travelMode) { initializeHopper(); long start = currentTimeMillis(); try { GHRequest request = new GHRequest(from.getLatitude(), from.getLongitude(), to.getLatitude(), to.getLongitude()); request.setVehicle(travelMode.getName().toUpperCase()); GHResponse response = hopper.route(request); if(response.hasErrors()) { String errors = printArrayToDialogString(response.getErrors().toArray(), false); log.severe(format("Error while routing between %s and %s: %s", from, to, errors)); throw new RuntimeException(errors); } PathWrapper best = response.getBest(); return new RoutingResult(asPositions(best.getPoints()), new DistanceAndTime(best.getDistance(), best.getTime() / 1000), true); } finally { long end = currentTimeMillis(); log.info("GraphHopper: routing from " + from + " to " + to + " took " + (end - start) + " milliseconds"); } }
if (vehicle.isEmpty()) { vehicle = getDefaultVehicle().toString(); request.setVehicle(vehicle);
if (vehicle.isEmpty()) { vehicle = getDefaultVehicle().toString(); request.setVehicle(vehicle);
request.setVehicle(vehicle);