10

I measure the area of a polygon with the QGIS Calculator: The cartesian area($ geometry) calculation function gives the same result for QGIS versions 2.16 and 3.4.5, but it is different with the $area function as shown in the image:

enter image description here

I don't understand why because the EPSG code and the ellipsoid are identical.

Could someone explain to me?

3
  • 1
    Does this answer your question? Why the strange area calculation in QGIS?
    – Hornbydd
    Commented Feb 21, 2020 at 12:59
  • @Hornbydd This is not a duplicate of Why the strange area calculation in QGIS?. @fcka asks why QGIS 2 and QGIS 3 return different value for $area function. Commented Feb 21, 2020 at 14:04
  • The question was phrased weirdly and I didn't understand the issue at first too.My guess is that it might have something to do with the different PROJ versions between QGIS 2 and 3.
    – Gabriel
    Commented Feb 21, 2020 at 14:10

1 Answer 1

13

QGIS Field Calculator explains why outputs of area($ geometry) and $area are different:

area returns the area of a geometry polygon object. Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.

EDIT: But I've noticed later that $area function returns different results for QGIS 2 and 3. I didn't understand that you asked that. Because the question was not clear. I tried to figure out what was the reason, and dead end. I think that it's a bug as @Stu state. I've reported this issue: #34597

EDIT 2: @ndawson's answer to the bug report:

Trust the QGIS 3 results. They are much more accurate and reliable vs QGIS 2 which had some known bugs in area calculation.

3
  • 2
    I made myself poorly understood : v2.16 area/10^6 : 44.1616749713555 area($geometry)/10^6 44.18969 v3.4.5 area/10^6 : 44.123126786646495 area($geometry)/10^6 44.18969
    – fcka
    Commented Feb 20, 2020 at 22:15
  • 3
    Perhaps this should be reported as a bug.
    – Stu Smith
    Commented Feb 21, 2020 at 5:35
  • 2
    @StuSmith I think it is a bug, I ve reported the issue. Commented Feb 21, 2020 at 10:30

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