After some experimenting and help from the Belgian OSM Community, I figured out how to tweak the parameters for the routing engine and steer the navigation process. It seemed as if the technical documentation was missing, so lets write it here.
The parameter file: routing.xml
All parameters for the routing file are stored in a single XML.
This document should be placed in a place where OsmAnd will find it. As I chose 'external storage' to store my maps (
general settings ->
Data Storage Folder (under miscellaneous title), adding this custom routing is easy.
Plug your phone in your computer and go to the path
Reading the parameter file
routing.xml is actually documented quite good! Read the docs there to get some general idea.
Adding an option to a profile
The parameters are split per profile. I edited the bicycle profile, as that is what I use most (also see my previous diary entry).
Over there, add a toggle, e.g., if you want to avoid sett surfaces:
<parameter id="avoid_sett" name="Strongly prefer asphalt and paving stones" description="Tries to route around sett and cobblestone, ideal if riding with a cycling cart" type="boolean"/>
id is the name you'll use in if-statements, the
name is what shows up in OSMAnd. Save the file as described above and restart OsmAnd. Start navigation to somewhere. If you click the settings (the cogwheel on the bottom when starting navigation), your new parameter should show up!
Routing considers three major aspects:
Each of those aspects has its own section in the xml; you can't miss them.
Access deduces if this road can be used or not. This is very hard: yes or no. If you want to create a profile to cycling with your toddler in the cart, and that toddler wakes up from the sett stones, you can add the following to avoid a condition in all cases:
<select value="-1" t="surface" v="sett"/> -- never ever enter a set road
Of course, you might want to avoid unknown surfaces too:
<select value="-1" /> -- Default: no access <select value="1" t="surface"/> -- only if a surface is known, allow access
And if you mix in the toggle, you'll get:
<if param="avoid_sett"> <select value="-1" t="surface" v="sett"/> </if>
The other aspects are tweaked similarly:
Speed is the maximal practical speed on a certain road. For example, if sett slows you down to 5 km/h; then you can tell the navigation:
<select value="5" t="surface" v="sett">
This is relative to other speeds. The default routing takes a default speed of
14.5 for cycling, so this would be way slower.
Priority is the preference of a road. If two routes are equal, the route with the highest priority is taken. However, as I modified both
priority in a similar way, it is hard to state the differences.
A sample use case
This custom routing can be tailored for your needs. See my other diary entry as an example and for the routes taken.