Is there an API in GH that I can use to compute the route given the lat and lon of start and end points?

Is there an API in GH that I can use to compute the route given the lat and lon of start and end points?

Hi there,

Have you had a look at this? https://github.com/graphhopper/graphhopper/blob/1.0/docs/android/index.md

This is what worked for me:

  1. Firstly, ensure that you have the latest version of Java installed.

  2. In your terminal in Linux. Install the GraphHopper Maps UI and the web service locally you need a JVM (>= Java 8) and do:

wget https://graphhopper.com/public/releases/graphhopper-web-3.2.jar https://raw.githubusercontent.com/graphhopper/graphhopper/3.x/config-example.yml http://download.geofabrik.de/africa-latest.osm.pbf
java -Ddw.graphhopper.datareader.file=63240014.osm.pbf -jar *.jar server config-example.yml'

**NOTE:** The latest version of graphhopper maps is version 4 (https://www.graphhopper.com/blog/2021/09/29/graphhopper-routing-engine-4-0-released/). You also need to specify your OSM map for your area of interest. Mine is Africa, as you can see above.

3. After a while you see a log message with 'Server - Started', then go to http://localhost:8989/ and you'll see a map of your specified OSM area. You should be able to right click on the map to create a route or specify lat. and long. for your start and end points.

I hope this helps!

The installation of GraphHopper is possible without the Android overhead. See here for a 2 liner: https://github.com/graphhopper/graphhopper#installation

emmm´╝î what I need is by coding, not the web-based way

Such as there is a method called f in a class, I just put in some args, it return the route

Please take a look at the documentation and see the examples module: https://github.com/graphhopper/graphhopper/blob/master/example/src/main/java/com/graphhopper/example/RoutingExample.java

Powered by Discourse