I have been given the big task of representing a lot of data in one symbol. The plan is to represent 5 categories of data in one symbol.

I hope to do this by changing factors such as:

  • Fill colour
  • Border colour
  • Shape
  • Orientation
  • Size

I planned on having:

  • Severity - changing border colour:
    - Serious - red
    - Slight - yellow
  • Road surface conditions - changing shape:
    - Dry - triangle
    - Wet - square
  • Light conditions - changing size:
    - Dark - small (4 points for example)
    - Light - large (8 points maybe)
  • Weather conditions - changing orientation:
    - Fine - vertical
    - Raining - 45 degrees clockwise
  • Casualty mode of transport - changing fill colour:
    - Pedal cycle - purple
    - Pedestrian - green
    - Moped - cyan
    - Car - black
    - Bus - white

Is there any way of doing this without typing out 80 separate statements and changing each variable individually?

  • 2
    expressions are your friend
    – Ian Turton
    Commented Mar 17, 2023 at 17:33

2 Answers 2


Using "Data defined override > Edit...", use the following expressions. (Edit field names)

enter image description here

For "Size":

  WHEN "Light"='Dark' THEN 4
  WHEN "Light"='Light' THEN 8

For "Fill color":

  WHEN "Casualty mode"='Pedal cycle' THEN 'purple'
  WHEN "Casualty mode"='Pedestrian' THEN 'green'
  WHEN "Casualty mode"='Moped' THEN 'cyan'
  WHEN "Casualty mode"='Car' THEN 'black'
  WHEN "Casualty mode"='Bus' THEN 'white'

For "Stroke color":

  WHEN "Severity"='Serious' THEN 'red'
  WHEN "Severity"='Slight' THEN 'yellow'

For "Rotation":

  WHEN "Weather"='Fine' THEN 0
  WHEN "Weather"='Raining' THEN 45

For "Shape":

  WHEN "Road surface"='Dry' THEN 'triangle'
  WHEN "Road surface"='Wet' THEN 'square'

Toy data and result:

enter image description here

  • Thank you so much for your help, I would never have got here on my own. The only problem I'm having is that I cannot seem to work out how to write the expression to change the shape. It doesn't have the same menu as the other features. Is there a trick to it? Commented Mar 20, 2023 at 11:02
  • I've added a screenshot. What is the geometry type of the layer? polygon, line or point? The answer is for a point layer. Commented Mar 20, 2023 at 11:20
  • And please remember that you need to change field names in expressions. I made it up for testing. Commented Mar 20, 2023 at 11:26

All of your visual variables can be driven by expressions so you need to write 5 expressions with a number of cases for each variable.

For Example

when  "conditions"  =  'wet' then 'square'
when  "conditions"  =  'dry' then 'triangle'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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