1
  1. I have a polygon and I create a new field area_ha using this expression in the field calculator: round( $area /10000,1)

    When I use that field for my labels, everything is fine and works as it should work:

    enter image description here

  2. I create a new field, but this time a virtual field with the name "area_ha_virtual_field". I use the same expression in the field calculator. The resulting value in the attribute table is fine. But when I want to use that new virtual field to label my blue polygon, it shows a totally different number than in my attribute table:

    enter image description here

  3. Also, I get that same weird number as a label, when I use that expression in my labeling properties:

    enter image description here

My CRS is 25832.

3
  • What is QGIS version? I use v 3.16 and there is no problem. Apr 13, 2021 at 18:45
  • 1
    have you tried area($geometry) instead of $area?
    – Erik
    Apr 13, 2021 at 20:14
  • 1
    @Erik: round(area($geometry)/10000,1) did the trick! Thanks! Apr 14, 2021 at 20:47

1 Answer 1

2

As @Erik suggested: When I use round(area($geometry)/10000,1) instead of round( $area /10000,1) the virtual values are displayed correctly as labels.

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.