For example, my "roads" vector layer has the following attributes:
- road type: primary, secondary, local, track, or path
- surface: sealed, or unsealed
- segment type: road, bridge, tunnel, floodway, culvert, and few more types
- relevancy: 1..9 (related to scale / zoom level)
Which yields almost 1000 unique styles but only 10% is present in data (for example, there are no unsealed primary roads)
In general styling rules are simple:
- any path should be dashed black line (0.25mm pen width)
- any unsealed road should be dashed
- primary and secondary roads should be red (0.6mm pen width)
- local roads and tracks should be orange (0.4mm pen width)
- tracks should be dashed
- each segment type has specific rendering:
- road: no change
- tunnel: keep colour and pen width but change line to dotted and draw portals
- and so on ..
So far, I've tried to use "Single Symbol" based on segment type and then use "Expression" for colour, pen width & style. I couldn't figure out how deal with relevancy so I switched to "Rule-based".
"Rule-based" can deal with relevancy, but number of rules is high. I can't figure out how use "Refine selected rule" > "Add categories to rule" to change pen style only and keep the colour.
In both cases I have to copy attribute expressions across the rules (not sure if there is a concept of "global" expression) and it's tedious to keep then in sync.