graphhopper GHRequest没有获取

时间:2014-03-29 08:44:26

标签: graphhopper

我对此代码有疑问:

    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));

它给了我这个错误:

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

1 个答案:

答案 0 :(得分:0)

文档目前正在进行更改(将其从wiki移至源代码)。你在哪里找到那个片段?请尝试gh.load("http://localhost:8989/");获取最新分支,然后gh.load("http://localhost:8989/api");