Issues with foot.lua profile

I am having a problem with the foot.lua profile developing spurious trails.
Sample query is


The profile is from git source.
Downloaded new-zealand-latest.osm.pbf. And set up two osrm data trees

cd car
osrm-extract -p /opt/osrm/car.opt new-zealand-latest.osm.pbf
osrm-partition new-zealand-latest.osrm
osrm-customize new-zealand-latest.osrm
cd …/foot
osrm-extract -p /opt/osrm/foot.opt new-zealand-latest.osm.pbf
osrm-partition new-zealand-latest.osrm
osrm-customize new-zealand-latest.osrm

If i run

osrm-routed -a MLD car/new-zealand-latest

the trail draws correctly

If i run

osrm-routed -a MLD foot/new-zealand-latest

the trail draws garbage

It appears that routed is trying to avoid the road “SH 6” (state highway 6). I have enable debug on osrm-routed but it reports nothing. What can I do to diagnose the creation of the dataset.
I have no issues with a dataset for Australia foot trails.


Friendly tip: please don’t use pejorative words like “garbage” when reporting an issue to open-source maintainers.

As you’ve noticed, OSRM’s default foot profile avoids trunk roads. This is because, in large parts of the world, highway=trunk is used to mean a road on which people aren’t permitted to walk.

If you’re setting up your own instance of OSRM, and you just want to run it for NZ, this is pretty easy to fix. Simply edit foot.lua and add trunk (and trunk_link) to the list of permissible highway types.

Alternatively, you can tell OSRM to use different defaults for different regions. Using location dependent data in profiles · Project-OSRM/osrm-backend Wiki · GitHub is a high-level overview of how that works.

Adding location polygons to the OSRM repo so that everyone got this out-of-the-box would be an interesting challenge and not one anyone has yet taken on!

Couldn’t open the localhost page, so could you please give us the start & finish locations as OSM links so we can check it?


Actually it shows the exact problem - choosing

Hmm? GraphHopper & Valhalla are both routing foot traffic along the highway OK, so it would appear that yes, OSRM just doesn’t like the Trunk road for foot traffic.

Sorry, not much more that I can say about it, beyond the fact that OSRM does strange things occasionally.

Somebody else may have a better idea, but maybe report a bug?

I closed the defect as it seems that the problem is a known issue. Based on comments in the wiki
(Key:motorroad - OpenStreetMap Wiki and
OSM tags for routing/Access restrictions - OpenStreetMap Wiki
– (esp #Alternative_ideas)
I wrote some “lua” scripting to addresss my issues. I atteched the code to the issue and closed it.
Thanks for all your advice Fizzie41

1 Like