[GIS] Symbology using multiple attributes in QGIS 2.18

attribute-tablelegendqgissymbology

Within a single polygon shapefile, describing the geological regions of Canada, I have 5 attributes I am hoping to combine to present a cohesive symbology. For the Legend I would like to display data from the "GENETIC250" field and, where that is blank, from the "GENETIC1MA" field. These data will also be ideally represented using the RBG values given within the 3 relevant columns. This last step is done easily enough, i.e.color_rgb("RED","GREEN","BLUE"), but I am struggling to incorporate the other expressions into the symbology.

Using QGIS 2.18.x, can anyone suggest a solution?

Geology

Best Answer

Perhaps try a conditional. For example if you are using categorised symbology, under Column you could put

if("Genetic250" IS NULL,"Genetic1MA","Genetic250")

Then you will get symbols for all values of Genetic250, and where that is null then you will have symbols for all values of Genetic1MA (only where Genetic250 is null - this distinction should be made clear to anyone using the data).

You can also use this to individually set values for your symbology, for example if("Genetic250" IS NULL,"Genetic1MA","Genetic250") = 'ridged till' will display features #10690 - #10693 in your data.

Whereas if("Genetic250" IS NULL,"Genetic1MA","Genetic250") = 'rogen moraine' will display features #10688 - #10689 even though #10690 - #10693 also have the same Genetic1MA value.

If that is confusing you could use "Genetic250" = 'ridged till' and "Genetic250" IS NULL AND "Genetic1MA" = 'rogen moraine' for the above two situations respectively, but it's easier to make mistakes...

How are you implementing the colour symbology? As far as I am aware, using data-defined overrides for colour will not show up on the legend (How to style a vector layer in QGIS using hexadecimal color code stored in attribute?)