I have project which gets updated regularly and can have multiple areas which need to be mapped individually to go into separate reports. I generate an atlas in the composer and I have created a rule-based style using the following:

attribute(  $currentfeature , 'id') =  attribute(  @atlas_feature , 'id')

This allow the user to go through each property, and if they are close together, then you only see the features for that specific area, not adjacent ones that might be in the map view. In the map composer, I can get the name of the area I am mapping and use in the title of the map using the string below (which changes each time you go to the next area within the atlas.

[% @atlas_pagename %] Rest of Title

One of the key issues i'm facing now is showing in the legend the areal measurement of what I am mapping. The following code; if I use a categorized style; will give me that label I am looking for (Property Boundary 100ha), but as it is not rule based, the surrounding features are not filtered out based on the atlas.

  concat('Property Boundary ',round(area(transform($geometry,'EPSG:4283','EPSG:3308') )/10000), 'ha')

I tried using a rule based system and then applied a categorised style, but the label came out as the following in the label.

concat('Property Boundary ',round(area(transform($geometry,'EPSG:4283','EPSG:3308') )/10000), 'ha') = 'Property Boundary = 100ha'

Is there a way I can filter polygons based upon the atlas and dynamically change the label/legend value to reflect the area using the tools within QGIS (without running Python scripts).

  • Are you adding this label to the legend as a text box?
    – Dùn Caan
    Jan 19, 2016 at 16:52
  • Not as a text box, but within the actual legend itself. As I mentioned above, I can the labels I want using a categorised style, but I then cannot apply a rule to filter this out. If I apply a rule, then categorise; the labels are of the expression, not the output like when using the categorised style in isolation.
    – Liam G
    Jan 19, 2016 at 22:06

1 Answer 1


I think it may be a problem with where your /10000 is.

Try: concat('Property Boundary: ',round(area(transform($geometry,'ESPG:4283','ESPG:3308')))/10000,' ha')

  • Because I want the area rounded in hectares having the /10000 after the third ) will actually put it back to a decimal, rather than an integer. The expression itself is not the issue, it is using the expression along with a filter to automate the legend value to have the area of the feature being mapped. Thanks for answer though.
    – Liam G
    Jan 19, 2016 at 22:09
  • Right yeah thought that may be the case, you could probably convert to an integer then? Seems odd the expression works in categorised styles but not rule-based. I'll have another look tomorrow.
    – Dùn Caan
    Jan 19, 2016 at 23:11
  • 1
    Yeh if I use the rule based then categorise the label turns to concat('Property Boundary: ',round(area(transform($geometry,'ESPG:4283','ESPG:3308')))/10000,' ha') = 'Property Boundary 100ha' Whereas just using categorised I get the label Property Boundary 100ha So it may be a QGIS bug where it is using the expression as the label, rather than the expression output
    – Liam G
    Jan 19, 2016 at 23:41

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.