[OSRM-talk] Example of restricted access flags for way_function and turn_function

Mateusz Loskot mateusz at loskot.net
Sat Jul 1 16:21:08 UTC 2017


Thanks for the pointers. I'll check them in details.

So, I understand purpose of turn_function is to tweak penalty based on

I'm wondering about slightly different use case and I'm trying to
understand which
tool, way_function or turn_function or neither, is the right way to use.
Shortly, in my use case a restriction is related to allowed/disallowed
turn from one link to another.
Let's consider simple network.


Let's assume, all links are bidirectional ways.
Node B includes information about turn restriction like so:
- turning from AB link to BD link is disallowed
- turning from AB link to CB link is allowed

AFAIU, object in turn_function has no context related to B node and
adjecent links to,
eg. calculate artificial high penalty to effectively block AB to BD turn
I'm also not sure there is way to include necessary context details in
object passed to way_function.

But, perhaps I'm missing some advanced profile tricks here.
So, does processing of such restrictions fit purpose of turn_function at all?

One of feasible alternative approaches is to pre-process such network
splitting the B node to B and B-prim

A - B - C
C - B' - D

This would effectively disable travelling along A - B - D

I'll appreciate any comments.

Best regards,

On 1 July 2017 at 10:41, Daniel Hofmann <hofmann at mapbox.com> wrote:
> You are correct, the way function can set a "restricted" flag per way (and
> direction), which you can then use in the turn function to put a high
> penalty on turns from/to "restricted" ways.
> The general idea is outlined here:
> https://www.openstreetmap.org/user/happygo/diary/40564
> Have a look at ExtractionWay, ExtractionTurn and the EdgeBasedGraphFactory.
> Cheers,
> Daniel J H
> On Sat, Jul 1, 2017 at 12:08 AM, Mateusz Loskot <mateusz at loskot.net> wrote:
>> Hi,
>> I'm trying to learn about use of the way_function result flags,
>> forward_restricted and backward_restricted, and their correspondence
>> with turn_function machinery, especially input source_restricted and
>> target_restricted flags.
>> Is there any data and profile example which shoes these in action?
>> I guess, way_function is called first and any of the restriction flags set
>> here for the link are passed to turn_function. Correct?
>> Disclaimer: I haven't looked into OSRM implementation details yet,
>> which, once grasped, I guess, might be enlightening.
>> Best regards,
>> --
>> Mateusz Loskot, http://mateusz.loskot.net

Mateusz Loskot, http://mateusz.loskot.net

More information about the OSRM-talk mailing list