[OSRM-talk] How to disable all ferry routes?

Daniel Hofmann hofmann at mapbox.com
Thu Nov 12 00:50:06 UTC 2015


Let me show you how you can find out more about specific variables like
mode_ferry:

your best bet is to search the code base, for example, see this initial
search for mode_ferry:

https://github.com/Project-OSRM/osrm-backend/search?utf8=%E2%9C%93&q=mode_ferry&type=Code

you can see how we set result.forward_mode and result.backward_mode to
mode_ferry there, so let's search for forward_mode:

https://github.com/Project-OSRM/osrm-backend/search?utf8=%E2%9C%93&q=forward_mode&type=Code

this gives us some lua profiles, which we ignore, since we want to see how
the OSRM implementation uses forward_mode and backward_mode; the last
search hit is scripting_environment.cpp:

https://github.com/Project-OSRM/osrm-backend/blob/8f6fc0146ba76d34d20c5b7a87b75249bbb12b82/extractor/scripting_environment.cpp#L121-L124

this is where we expose the ExtractionWay's set_forward_mode and
set_backward_mode member functions, aliasing them to the lua properties
forward_mode and backward_mode --- so let's go on searching for the
ExtractionWay type:

https://github.com/Project-OSRM/osrm-backend/blob/8f6fc0146ba76d34d20c5b7a87b75249bbb12b82/extractor/extraction_way.hpp#L112-L115

in those member functions, the forward_travel_mode and backward_travel_mode
are set accordingly. If you check their types a few lines below in the
member attribute declarations, you will see they are of type TravelMode.
And here it is:

https://github.com/Project-OSRM/osrm-backend/blob/8f6fc0146ba76d34d20c5b7a87b75249bbb12b82/data_structures/travel_mode.hpp#L34-L35

a quick search for TRAVEL_MODE_INACCESSIBLE reveals the following line in
the extractor:

https://github.com/Project-OSRM/osrm-backend/blob/9ef1f8cba31ec8323b357d233f1c552b1c7c9e09/extractor/extractor_callbacks.cpp#L95-L99

where ways are discarded, if they are inaccessible! Tada!


As you can see, even though it is quite a bit of effort tracing back
specific variables, it can be done in a few minutes with only the most
basic tools (I did this entirely using the Github search functionality ---
of course you can use grep or your code browser of choice, too).

Hope that helps,
Daniel J H

On Wed, Nov 11, 2015 at 7:06 PM, Richard Marsden <winwaed at gmail.com> wrote:

> By coincidence I was working through the lua scripts trying to understand
> them.
>
> So what is the significance of the 1,2,3?  Just unique identifiers. As
> long as they're non-zero, they will be enabled?
>
> Richard
>
>
> On Nov 11, 2015, at 9:23 AM, Daniel Hofmann <hofmann at mapbox.com> wrote:
>
> If you take a look at the car profile, you will see a ferry_mode variable,
> that sets the travel mode:
>
>
> https://github.com/Project-OSRM/osrm-backend/blob/8f6fc0146ba76d34d20c5b7a87b75249bbb12b82/profiles/car.lua#L151
>
> If you set this to 0 (i.e. 'inaccessible") as defined here:
>
>
> https://github.com/Project-OSRM/osrm-backend/blob/8f6fc0146ba76d34d20c5b7a87b75249bbb12b82/data_structures/travel_mode.hpp#L34-L35
>
> then the extractor discards ferry routes because you marked them
> inaccessible.
>
> On Wed, Nov 11, 2015 at 9:03 AM, Peter Becker <floyd.net at gmail.com> wrote:
>
>> Hello, i dont want any ferries in my routes. Is this possible?
>>
>> _______________________________________________
>> OSRM-talk mailing list
>> OSRM-talk at openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/osrm-talk
>>
>
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
>
> _______________________________________________
> 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/20151111/960254f5/attachment.html>


More information about the OSRM-talk mailing list