0

A person is somewhere in a city and wants to know the network distance to the closest supermarket.

Is there any way I could solve this problem with the GraphHopper program/library (not the API)?

1
  • 1
    Put in the coordinate of the person and the coordinate of the supermarket or iterate over the list of supermarkets and pick the closest?
    – Karussell
    Commented Jun 1, 2017 at 9:53

1 Answer 1

1

You can either use Graphhoper One To Many shortest paths using this code:

L.Routing.control({
  waypoints: [
    origin point,
    points of interest
  ],
  router: L.Routing.graphHopper('your token'),
  parameters: {
    vehicle: 'car'
  },
  routeWhileDragging: false
}).addTo(map);
}

or just use leaflet-knn to check points of interest within a specific distance (euclidean distance) and afterwards use Graphhopper compare those routes and choose to serve the shortest one.

Good luck!

1
  • Thanks for your answer. Like stated in my question I do not want to use the API. I want to do it purely offline using the GraphHopper Java program. Commented Jul 10, 2017 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.