I need this for a university project and have been trying everything I could without success...

I had this shapefile from our region (LAZIO) where I could easily get out of it area values and from the IDs I was able to isolate the different kind of soil usages with the rule based style editor.

Now I need to work with the table to extrapolate aggregate various area values and other data (plantation type and such...). I was thinking to export the table directly to Excel but the main problem now is my final step, I can't find a way to show in the attribute table the name of the rule based style and I need this to sort which area is from which layer when I'll export that so I can make some graphs...

any help in how to show the style name/id in the attribute table?

named rule based style I need in the table

the table where I need to add a column with the style

If not possible this way, how can I achieve that?


You're working with a vector layer which has a "categorized" symbology (cusarp2010). if you want to see the rules on which the symbology is based you have to right-click on the layer in the layer panel then choose properties / symbology and you will see the rules that have been used. I suppose some of your "codice" values have been grouped to build your 5 classes.


The relationship between rule and label you have used for the display can be directly translated into expression in the Field calculator.

The expression would be like CASE WHEN rule THEN label.

enter image description here

  • um...probably I am badly mistaken the question – Kazuhito May 13 '18 at 11:27
  • ok, no i think you understand it good despite my bad description... anyway to add to that: as i have imported my region file into qgis with the map and the data i have created the different rule based style like this (example rule: SOIL1) CODICE = '111' or '112' or ... ; to identify the regions by their ID and assigning them different colors, so don't have quite the rules as you showed... now i should need something like you said to call in the table the name of the style assigned to every specific code (in the example: at the row CODICE '111' i need a column that say Soil 1. – Harlock May 13 '18 at 21:25
  • Thanks @Harlock If you can find out the list of such combinations, CASE WHEN "CODICE" = '111' OR "CODICE" = '112' THEN can be expandable by adding multiple OR functions. But, I understand it is painful. – Kazuhito May 14 '18 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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