-
Notifications
You must be signed in to change notification settings - Fork 5
EN—Routing
I started from the routing.xml file used by OsmAnd for all its default profiles and proposed *here *
I kept only the part concerning the car that I adapted for 3 uses
- heavy trailbike (very road tires)
- light trailbike (50/50 tires)
- enduro bike
to follow the tracks categories defined in the rendering style.
among the important parameters, <attribute name="heuristicCoefficient" value="3.4" />
greatly affects the speed of calculation of a route on the one hand and on its "compliance" with the criteria expressed then (of course it's inversely proportional!!!
the higher it is, the less "accurate" the results are in relation to an ideal time/distance between 2 points.)
what i found while testing
- the higher the number, the faster the calculation (from several minutes to a few seconds between 1.4 and 7.0)
- the higher the number, the more the result of the calculation differs between my phone and my emulator (10% for a value of 7.0)
- the higher the number, the more "aberrations" such as a pedestrian walkway or part of cycleway appear here the value 3.4 presents a good compromise speed of calculation/choice of paths, you can experiment with other values at will.
is in this block which includes all the other blocks described below.
<routingProfile name="gros_trail" baseProfile="car" restrictionsAware="true" minSpeed="1" defaultSpeed="30.0" maxSpeed="90.0" sharpTurn="" slightTurn="" roundaboutTurn="" followSpeedLimitations="false" onewayAware ="true">
.....
</routingProfile>
at the beginning of this block the options in the menu "Navigation settings" then ""Route parameters" and finally "Avoid roads" of the profile to which this routing will be assigned , like here "pas de chemins" from "gros_trail" routing
<parameter id="avoid_track" name="pas de chemin" description="avoid tracks" type="boolean" default="false"/>
which translates like this in use
and reference to the "avoid_track" block of the "priority" block (see below)
<if param="avoid_track">
<select value="0.55" t="tracktype" v="grade2"/>
<select value="0.6" t="tracktype" v="grade1"/>
</if>
where each value="..." set preference for routing.
<way attribute="access">
<select value="-1" t="osmand_change" v="delete"/>
<select value="-1" t="build" v="yes"/>
<select value="-1" t="smoothness" v="impassable"/>
<select value="-1" t="highway" v="path"/>
defined by yes (1) or no (-1) access and consideration for guidance. (the if allow a choice relative to an option defined at the beginning)
put here all the ways (roads, paths, trails) or tags that you don't want to take.
it is here that it decides the respect or not of the prohibitions, with <if>
for the "private".
is taken from the default OsmAnd, unless you want to drive against the direction, no need to modify it.
allows you to obtain the most realistic ETA (estimated time to arrive) possible
BUT ESPECIALLY makes it possible to define the basic hierarchy of choice of the paths to be taken by the calculation, the fastest always being the first choice of the engine.
is the most important of all for the choice of paths with its sub-blocks.
the choice of paths by the engine is done like this
max profile speed divided by track speed (defined in the "speed" block) x priority given in this block
- max profile speed =90
- speed tracktype grade1 =45
- priority tracktype grade1 =2 (a higher value will have no effect) with roads whose priority is very low (from 0.2 to 0.5) the paths which have the tag "tracktype=grade1" are favored to the maximum
the principle consists in giving a preference to each element between 0 and 1 and beyond 1,
if "1" the routing calculation engine does not apply a penalty and uses the speed defined in the "speed" block,
if 0.x the engine will decrease the speed of this element,
if greater than 1 the speed of the element will be increased by the defined factor (I refer you to the help included in the OsmAnd routing file)
prohibits or penalizes according to elements present in osm and listed in the block
is of no interest for our use (see doc in OsmAnd's routing.xml file)