I have setup OSRM backend and frontend using profiles/foot.lua aka walking profile. The routing works well untill a trunk road (OSM tag: highway=trunk) comes along or between the origin and destination points. When that happens, I get this: skirting around the trunk

When giving walking directions, OSRM seems to be avoiding trunk roads like the plague. Now it may be the case in some countries that pedestrians aren't allowed on trunk roads, but I can assure you it's not the case for the places that I want to cover. How does one convince one's local OSRM instance that trunk roads are ok for pedestrians?
FYI: I've built OSRM from source following their github wiki pages. No docker.


Modify foot.lua like so:

speeds = Sequence {
  highway = {
    primary         = walking_speed,
    primary_link    = walking_speed,
    secondary       = walking_speed,
    secondary_link  = walking_speed,
    tertiary        = walking_speed,
    tertiary_link   = walking_speed,
    unclassified    = walking_speed,
    residential     = walking_speed,
    road            = walking_speed,
    living_street   = walking_speed,
    service         = walking_speed,
    track           = walking_speed,
    path            = walking_speed,
    steps           = walking_speed,
    pedestrian      = walking_speed,
    footway         = walking_speed,
    pier            = walking_speed,
    -- adding trunk 
    trunk           = walking_speed,
    trunk_link      = walking_speed

Adding lines for trunk roads under speeds = Sequence { section legitimizes them. And then, the same origin-destination query gives this result: no longer skirting around the trunk

Hope this helps someone. I tinkered around with a dozen other things in the profile unsuccessfully before giving this part a shot.

Another possible way to solve this, at the data end:
Add pedestrian-friendly attributes to the highway=trunk roads. When you open such a place in OSM's default browser-based editor iD and select the trunk road, some metadata fields come up:

OSM editor highway=trunk selected

Setting a tag like foot=yes ought to do it, but disclaimer: I haven't tried this out yet.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.