2

OpenStreetMap uses specific tags to describe route symbols that are used as waymarker (https://wiki.openstreetmap.org/wiki/Key:osmc:symbol).

For example: "osmc:symbol"=>"red:white:red_dot"

I would like to translate that key syntax into a symbol geometry with QGIS similar to the OSM composer does (https://wiki.openstreetmap.org/wiki/OSM_Composer). But the only idea I get into my mind is:

  1. build SVG-symbols for every possible combination (with Inkscape)
  2. Name every symbol with the relating key (like 'red_white_red_dot.svg')
  3. Use data defined override at an SVG marker line, where the SVG markers path is set up with the osmc:symbol field from the attribute table

That seems to be a not very elegant solution: Too static, too much work and too inflexible.

I'm looking for a better solution. Any ideas?

2

The logic in the tagging (osmc:symbol=waycolor:background[:foreground][[:foreground2]:text:textcolor]) can be translated into symbology using the rule-based styling.

Make a layered style and define a rule for every part of the osmc-tag using regex or QGIS-build-in string-expressions.

Or you can 'explode' the tag into different attributes, based on the delimitter ':' (by using eg. virtual fields). An example of splitting based on a ',': Splitting field with comma as separator into two fields in QGIS. Then you can assign a symbol based on the values you extracted.

--- EDIT ---

In QGIS 3 this is less complicated with the array-expressions that are provided since.

array_get(string_to_array('red:white:red_dot',':'),0) returns 'red' array_get(string_to_array('red:white:red_dot',':'),1) returns 'white' array_get(string_to_array('red:white:red_dot',':'),2) returns 'red_dot'

Use string_to_array() splitting on : to make an array ['red', 'white', 'red_dot']

Use array_get() combined with 0 to get te first part, 1 to get the second part, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.