To configure OsmAnd to avoid A-class roads (A1-A19) in Lithuania for cargo trucks, you'll need to modify the routing.xml file. Here's how to set this up:
In your routing.xml file, you'll want to add specific avoidance rules for trunk roads and motorways in Lithuania. Add or modify these sections:
<!-- Add to the routing profile section (e.g., truck or car profile) -->
<parameter id="avoid_motorway" name="Avoid motorways" description="Avoid motorways" type="boolean"/>
<parameter id="avoid_trunk" name="Avoid trunk roads" description="Avoid trunk roads" type="boolean"/>
<!-- In the way priority section, set negative values for trunk and motorway -->
<way attribute="highway" value="motorway">
<if param="avoid_motorway">
<speed value="0" priority="-1"/>
</if>
</way>
<way attribute="highway" value="trunk">
<if param="avoid_trunk">
<speed value="0" priority="-1"/>
</if>
</way>
<way attribute="highway" value="motorway_link">
<if param="avoid_motorway">
<speed value="0" priority="-1"/>
</if>
</way>
<way attribute="highway" value="trunk_link">
<if param="avoid_trunk">
<speed value="0" priority="-1"/>
</if>
</way>
For a more specific Lithuania-focused approach, you can also add rules based on road references:
<!-- Avoid specific A-roads by reference -->
<way attribute="ref" value="A1|A2|A3|A4|A5|A6|A7|A8|A9|A10|A11|A12|A13|A14|A15|A16|A17|A18|A19">
<speed value="0" priority="-1"/>
</way>
After modifying the routing.xml file:
- Save the file and place it in the OsmAnd routing folder (usually in Android/data/net.osmand/files/routing/)
- In OsmAnd app, go to Settings → Navigation settings → Navigation profile
- Enable "Avoid motorways" and "Avoid trunk roads" options
- The routing engine will now calculate routes avoiding these road types
This setup will make OsmAnd route cargo trucks around the paid A-roads, using alternative routes like regional roads (marked with numbers like 131, 144, etc.) instead.