Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
    }

}
like image 533
bilo-io Avatar asked Nov 24 '15 15:11

bilo-io


1 Answers

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

like image 80
Karussell Avatar answered Sep 19 '22 23:09

Karussell