0

I have a problem with this code:

    GraphHopperAPI gh = new GraphHopperWeb();
    gh.load("http://localhost:8989/api/route");
    GHResponse ph = gh.route(new GHRequest(45.104546,7.69043,45.104546,7.69043));

It gives me this error:

2014-03-29 09:33:00,036 [main] INFO  graphhopper.http.GraphHopperWeb - Full request     took:0.037406, API took:0.0

Exception in thread "main" java.lang.RuntimeException: Problem while fetching path 45.104546, 7.69043->45.104546, 7.69043   
        at com.graphhopper.http.GraphHopperWeb.route(GraphHopperWeb.java:119)
    at provaMain.main(provaMain.java:23)

Caused by: org.json.JSONException: A JSONObject text must begin with '{' at character 0
    at org.json.JSONTokener.syntaxError(JSONTokener.java:410)
    at org.json.JSONObject.<init>(JSONObject.java:179)
    at org.json.JSONObject.<init>(JSONObject.java:402)
    at com.graphhopper.http.GraphHopperWeb.route(GraphHopperWeb.java:95)
    ... 1 more
tshepang
  • 12,111
  • 21
  • 91
  • 136
A_Borgs
  • 11
  • 1

1 Answers1

0

The documentation currently undergoes a change (moving it from wiki to source). Where did you find that snippet? Please try gh.load("http://localhost:8989/"); for the latest branch and gh.load("http://localhost:8989/api"); before.

Karussell
  • 17,085
  • 16
  • 97
  • 197