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
    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 Jun 1 '17 at 9:53

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

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

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!

| improve this answer | |
  • 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. – coding_bird Jul 10 '17 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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