Announcing changes to `osmc:symbol` rendering in waymarkedtrails
Posted by lonvia on 19 May 2025 in English.Following various discussions and requests over the previous years, I’ve adapted parsing of the machine-readable osmc:symbol
tag in waymarkedtrails for route symbols to cover more use cases. The new implementation comes a bit closer to what is specified on the wiki website, most notably now supporting a second foreground, but also extending the list of supported backgrounds. This posts gives a bit of background on the changes.
Supported syntax
The official specification of the osmc:symbol
tag always had the issue that it largely relies on guessing the function of its parts from their content. A part called red_bar
? Must be a foreground description because there is no “bar” background and the content looks to be too long to be a text description, too. This is a viable way of describing something but not very robust against typos and it makes it very hard to extend the value set. waymarkedtrails has therefore implemented a subset of the specification that could be parsed in a way that the function is determined from the position of the parts. This subset was essentially: waycolor[:background[:foreground[:text[:textcolor]]]]
Unfortunately this approach made it impossible to support the second foreground when it popped up on the wiki page and that has left users confused ever since.
User mueschel has recently re-analised the format and came to the conclusion that we can still keep the positional approach when sticking to the following combinations of part descriptions:
waycolor:background
waycolor:background:foreground
waycolor:background:foreground:foreground2
waycolor:background:foreground:text:textcolor
waycolor:background:foreground:foreground2:text:textcolor
The one officially allowed variant that isn’t covered is waycolor:background:text:textcolor
. Luckily this variant isn’t really used in practice with very minor exceptions. And it can easily be made compliant by adding an empty foreground: waycolor:background::text:textcolor
.