5

Edit - I forgot that I had posted this until I was searching for information on this.

I have 2 land type layers (soil, vegetation types etc), one of the layers shows the land types for entire paddocks while the second layer shows only the land types in the paddock within a certain distance of water. What I want to do is have both layers with the same symbology but displaying different labels containing the land unit, land unit description and the total area of the land unit. Obviously the total area would be different between layers.

Further edit:

As an example based on the picture below, I would like to catagorise based on the first part of the text string eg "De" or "Bs-1" so that all layers have the same symbology regardless of their different areas.

I would then like to create the category descriptions with an expression similar to: 'MAPUNIT' || " - " || 'DESCRIPTION' || round(sum('AREA', 'MAPUNIT'), 2))

I'm wondering if it is possible to categorise layers in QGIS using one expression but label it using another? I have several layers based on the same dataset but clipped so they have different areas. I want to categorise them so the symbology matches between the layers but label the categories with the areas as well.

At the moment I am using the same expression for each layer but have to manually change the category colours to match.

In ArcMap, I used the advanced symbol legend label tool from maplogic for the this.

3km Land System Symbology

An example of what I'm doing. The colours and description stay the same but the area change based on buffered areas. I'm using an expression to categorise the layers e.g. 'MAPUNIT' || " - " || 'DESCRIPTION' || round(sum('AREA', 'MAPUNIT'), 2))

3
  • 2
    Could u detail a bit more how your project is structured ? AFAIK there is no connection between the symbology and the labeling so i would answer 'yes' !
    – Snaileater
    Commented Apr 6, 2019 at 7:42
  • By "labeling", do you actually mean the category descriptions of the symbology?
    – hexamon
    Commented Oct 8, 2019 at 7:24
  • Hi Hexamon, yes I do. Commented Oct 8, 2019 at 22:48

1 Answer 1

1

To define expression-based legend descriptions:

  • go under Layer properites (double click on the layer name)
  • select Legend
  • click on Set labels from expression
  • enter your expression

The expression can for example be something like this:

concat(  "MAPUNIT" ,' - ',  "DESCR" , ' ', "AREA", ' sqkm' )

enter image description here

Result:

enter image description here

Note: you can apply a completely independent expression to show as the Label of the same layer.

3
  • 1
    Holy shit, how have I never found the Set labels from expression option until now? Thanks for this tip! I have to check if this works with feature counts within a map frame or atlas feature perhaps....
    – she_weeds
    Commented Oct 10, 2019 at 8:34
  • It should work: the latter screenshot is taken from the Layout, and Atlas is based on Layouts. Commented Oct 10, 2019 at 9:56
  • 1
    Hmm, it appears to be a static label once you apply it and does not dynamically update if the source data/map/etc changes. Also I can't seem to reliably use aggregate functions in this context. But it is very useful for when I have used labels on symbols to mean something and want them to appear in the legend (without having to rely on font markers). Thanks!
    – she_weeds
    Commented Oct 12, 2019 at 2:04

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.