I am trying to get a simple graphhopper client to retrieve route response from my own hosted graphhopper server, but I am not able to retrieve any data from the local service. I've setup a local graphhopper service by following this guide: https://github.com/graphhopper/graphhopper/blob/master/docs/core/quickstart-from-source.md I've downloaded the OSM map NewYork.osm.pbf for working with a new york map data. After cloning the project and checking out the master branch, I start the service by running the following: ./graphhopper.sh web NewYork.osm.pbf On the client side I am following this guide: https://github.com/graphhopper/directions-api-java-client
After setting up the Maven dependency on the client project, my client tries to perform a very simple route retrieval of two valid New York City coordinates: (Chelsie Piers and Columbus Circle)
GraphHopperWeb gh = new GraphHopperWeb("localhost:8989/api/1/route");
gh.setDownloader(new OkHttpClient.Builder().
connectTimeout(5, TimeUnit.SECONDS).
readTimeout(5, TimeUnit.SECONDS).build());
// specify at least two coordinates
GHRequest req = new GHRequest();
req.addPoint(new GHPoint( 40.7469, -74.0083)).addPoint(new GHPoint( 40.7681, -73.9824));
req.setVehicle("foot");
req.setLocale(Locale.US);
GHResponse fullRes = gh.route(req);
if(fullRes.hasErrors()) {
return;
}
currently fullRes response object's error member is valid: no paths, main errors: [java.lang.RuntimeException: Not found] If I run the same example on the graphhopper hosted server by setting the client to :
GraphHopperWeb gh = new GraphHopperWeb(); gh.setKey("my graphhoper API key");
this retrieves a route response just fine. I am guessing I am not setting certain configuration files properly. I would love to know how to get this example working as well as know how to configure the local servers to generate API keys for graphhopper clients that need to authenticate to locally hosted graphhoper servers. Any help or links would be much appreciated.
Thank You.