GraphHopper路由引擎稳定版0.5出现问题

使用vehicle=car时我可以获取路线,但是自行车失败。

在GraphHopper Maps上步行约3分钟的Here is an example:

这会在 map 上产生一个很好的结果。

在本地运行时,我已经使用完全相同的坐标来获取JSON数据,如下所示:
http://localhost:8989/routes?point=-33.916567%2C18.417914&point=-33.917584%2C18.418935&locale=en-US&vehicle=foot
这不会产生任何结果,而是返回以下响应:

{
  "message": "Vehicle not supported: foot",
  "hints": [{
    "message": "Vehicle not supported: foot",
    "details": "java.lang.IllegalArgumentException"
  }]
}

请注意,将车辆更改为车辆会产生结果!如何解决?

为了完整起见,这是带有Vehicle = car的示例请求和响应
{
    "paths": [
    {
        "distance": 151.857,
        "time": 18222,
        "points_encoded": true,
        "weight": 151.857451,
        "instructions": [
        {
            "sign": 0,
            "text": "Continue onto Hudson Street",
            "time": 3782,
            "distance": 31.517,
            "interval": [
                0,
                1
            ]
        },
        {
            "sign": -2,
            "text": "Turn left onto Waterkant Street",
            "time": 14440,
            "distance": 120.34,
            "interval": [
                1,
                3
            ]
       },
        {
            "sign": 4,
            "text": "Finish!",
            "time": 0,
            "distance": 0,
            "interval": [
                3,
                3
            ]
        }],
        "bbox": [
            18.417884,
            -33.917672,
            18.418824,
            -33.916712
        ],
        "points": "nj_nEehloBh@l@|@uAvAeB"
        }
        ],
        "hints": {
        "visited_nodes.average": "20.0",
        "visited_nodes.sum": "20"
    },
    "info": {
        "copyrights": [
        "GraphHopper",
        "OpenStreetMap contributors"
        ],
    "took": 10
    }

}

最佳答案

您必须将其包含在config.properties中
graph.flagEncoders=car,foot,bike
顺便说一句:我已经编辑了你的帖子。为了阐明GraphHopper路由引擎和GraphHopper Directions API之间的区别,请参见here

关于routing - GraphHopper车辆=汽车工作,但脚或自行车不工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33897870/

10-09 12:58