2

I have to make a symbology based on a unique color value so I add a plus column to the attribute table with the number of color values. I went to the layer properties - style - data defined properties and trying to change the outline color, but it is so complicated. I have 5 different value numbers so if the value number is 2, it can be red, and so on... What codes should I use?

The map should look like this with different sizes and colors based on the unique value

enter image description here

1 Answer 1

2

Yes you can do it with fewer values, depending on the combinations you want of course. In the Data Defined Properties section, click on the curly E button to define an expression. When the Expression dialog box opens, you will probably want to define a conditional expression. Use the CASE ELSE option and create an expression something like this (for the Border color, say):

CASE
  WHEN style_attribute=2 THEN '255,0,0'
  WHEN style_attribute=3 THEN '0,255,0'
  ...
  ELSE '0,0,0'
END

The last one is a catch-all to make everything else have a black border.

You can then define similar expressions for other style elements such as the size and so on. NOTE the 'Help' section in the Data Defined properties dialog. It will give you a hint as to how the THEN clause should be formatted (in this case 'r,g,b' - the alpha here is the default).

2
  • Thank you for your help! And is there any similar code for radius size of circles? I have the size codes in attribute table as well.
    – mrbandy
    Commented Aug 27, 2014 at 20:20
  • Assuming you are using the standard simple marker circle, then do a similar thing but set the expression for the Size property (it just takes a single value of 'double' - the default is 2.0) so instead of "THEN '255,0,0'" put something like "THEN 25.5". If it is the ellipse marker then you will need to set both Symbol Width and Symbol Height properties. Commented Aug 28, 2014 at 8:57

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.