Search code examples
androidopenstreetmapgraphhoppermapsforge

Graphhopper Route for Pedestrian android


How do i set route type to Pedestrian in Graphhopper android? I have been using GHRequest.setVehicle() method in android, and it does not work. I have tried using "foot", and "bike". None worked. Also, it doesn't work when i changed Algorithms too. Only Dijkstra_BI is working now.

   GHRequest req = new GHRequest(fromLat, fromLon, toLat, toLon).
                    setAlgorithm(Algorithms.DIJKSTRA_BI).setVehicle("foot");

Thanks in Advance.

The map data that i have contain following files. enter image description here

I am getting the following error when I used

tmpHopp.setEncodingManager(new EncodingManager("foot"));

enter image description here

I have solved this problem thanks to karussell. I will write what i did for the people like me who might face this same problem.

What I did

In the graphhopper folder cloned from git, there is a file called config.properties. In the 5th line. change it to graph.flag_encoders=car,foot,bike

Thanks.


Solution

  • When you import the data (on the desktop/server machine) you have to specify the vehicles you need via graph.flag_encoders=bike,foot,... in the config.properties or in older versions graph.flagEncoders=bike,foot,...