GraphHopper车辆=汽车工作,但脚或自行车不工作 [英] GraphHopper vehicle=car works but foot or bike don't work

查看:301
本文介绍了GraphHopper车辆=汽车工作,但脚或自行车不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GraphHopper路由引擎稳定版0.5上遇到问题

I have an issue with the GraphHopper routing engine stable version 0.5

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

I can get directions when using the vehicle=car, but this fails with bike and foot.

这会在地图上产生一个很好的结果.

This yields a result on the map, which is great.

在本地运行此代码时,我曾使用完全相同坐标来获取JSON数据,如下所示:

I have used the exact same coordinates when running this locally, to obtain the JSON data as follows:

http://localhost:8989/routes?point=-33.916567%2C18.417914&point=-33.917584%2C18.418935&locale=en-US&vehicle=foot

这不会产生任何结果,而是返回以下响应:

This yields no result, but instead returns the following response:

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

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

Note that changing the vehicle to car yields a result! How can this be fixed??

出于完整性考虑,这是带有vehicle = car的示例请求和响应

For completeness sake, here is the sample request and response with 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中

You have to include it in your config.properties

graph.flagEncoders=car,foot,bike

顺便说一句:我已经编辑了您的帖子.要弄清楚GraphHopper路由引擎和GraphHopper Directions API之间的区别,请参见此处

BTW: I've edited your post. To clarify the difference between the GraphHopper routing engine and the GraphHopper Directions API see here

这篇关于GraphHopper车辆=汽车工作,但脚或自行车不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆