[OSRM-talk] Restrict access to tunnels

Roland Swingler roland at beeline.co
Tue Sep 28 17:03:33 UTC 2021


You _can_ do this by changing the process_way function in the profile
you're using. I.e. in the car.lua profile you could do something like

if (way:get_value_by_key("tunnel") == "yes")
then
    return
end

near the top of the function. Another way is to preprocess the osm file
with something like osmium tag-filter to exclude ways with that tag.

However you may find that removing tunnels altogether isn't what you want -
a lot of "tunnels" are really just the underside of railway bridges where
the road passes underneath for example, rather than what you might think of
as a tunnel. In this case you may just want to provide a penalty on the
weight of the way rather than removing it completely, so it can still be
routed across but long tunnels will be avoided. Or if you really need to
strip them, maybe think about doing something with the total length of the
tunnel.

HTH,
Roland

On Tue, 28 Sept 2021 at 17:11, Eduardo Sánchez <esanchezansola at gmail.com>
wrote:

> Hello, we are using OSRM in our project and we want to avoid the
> vehicles taking certain ways, specifically tunnels. Is any way to do
> this?
>
> Another question: it is possible to block specific ways by the name
> attribute?
>
> Best regards,
> Eduardo
>
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20210928/72417c6e/attachment.htm>


More information about the OSRM-talk mailing list