2

I have data symbolized with different categories Each category has a field for different symbology style like the table below. Is it possible to visualize the same category of data with in different styles without adding the layer twice?

I would like to do something like this
Category=Forest AND Symbology=1 THEN 'Green'
Category=Forest AND Symbology=2 THEN 'Blue'

In QGIS there is a selection "Data defined properties" with an expression builder, could it be done from it maybe?

Category Symbology
Forest 1
Forest 2
Shrub 1
Shrub 2
Grass 1
Grass 2

1 Answer 1

3

Use Rule-based styling as in the following image, click on the "plus" icon to add more items:

Rule-based styling

Note the double-quotation marks for Field/Column names and single-quotation marks for strings. Although you don't need double-quotes for Field/Columns, I think it's good practice as it highlights what it is, useful for long logics but this is personal opinion :)

7
  • 2
    Just to agree, and to add that if having done this you save the style as a QGIS layer style file you can then access this style file with a text/xml editor... which can make setting up of a complex set of interrelated styles faster than doing it one by one directly in QGIS. Jan 22, 2015 at 13:56
  • @user27285, I save style files often but never edited one. But you're right in that it could save a lot of time.
    – Joseph
    Jan 22, 2015 at 13:59
  • Thank you! That worked perfectly, never thought of rule based styling before, should have looked more carefully =) Good point about being able to edit the layer style files with an editor.
    – geogrow
    Jan 22, 2015 at 14:17
  • The style file is an xml file. In case you aren't familiar with this take a moment to understand a few of the basics about what an xml file looks like (quick Google search) - QGIS uses these a lot, and familiarity with what they look like in general is helpful (the rest you can mostly work out from studying the file produced by QGIS). And try to use a text editor which is advanced enough to support you - one which will tell you if you make a mistake, or which will allow you to fold sections of the file and colour code the text. Jan 22, 2015 at 17:19
  • Is it anyone you can recommend? I have used Notepad++ a bit before, but that is also the only one
    – geogrow
    Jan 23, 2015 at 10:22

Your Answer

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

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