GraphHopper vehicle=car works but foot or bike don't work

放肆的年华 提交于 2019-12-04 01:24:35

问题


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

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

Here is an example of a roughly 3-minute walk on GraphHopper Maps:

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

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??

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
    }

}

回答1:


You have to include it in your config.properties

graph.flagEncoders=car,foot,bike

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



来源:https://stackoverflow.com/questions/33897870/graphhopper-vehicle-car-works-but-foot-or-bike-dont-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!