Bug report #17467

Function $area

Added by Thomas Nogatz over 6 years ago. Updated over 6 years ago.

Category:Field calculator
Affected QGIS version:2.18.9 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:25364


The function $area (field calculator) does not deliver reliable values in every case.
I have attached two example projects using the same shapefile. Both projects and the shapefile use the same projection (EPSG:25833).
The field "area_1" has been calculated by "export/add geometry columns", which delivers correct values in every case.
Field "t_$area2" was calculated using "$area" in project "01.qgs". The field "diff2" = abs("area_1"-"t_$area2") indicates that $area calculates correctly.
Field "t_$area3" was calculated using "$area" in project "02.qgs". The field "diff3" = abs("area_1"-"t_$area3") indicates that $area calculates not correctly.

Project 01 is a new created project.
Project 02 is a project deriving from a different project with much more layers (vector, raster, wms) which I have deleted for this test.

The Problem exists in older QGIS versions as well.

area.zip - 21 kB (20.1 KB) Thomas Nogatz, 2017-11-15 09:49 AM


#1 Updated by Giovanni Manghi over 6 years ago

  • Resolution set to invalid
  • Operating System deleted (Windows 10)
  • Status changed from Open to Closed
  • Category changed from Expressions to Field calculator

The point is that in project 2 you have OTFR enabled and set an ellipsoid (wgs84) for measurements (in project properties), in project 1 you don't have OTFR enabled so it use the plane for measurements. If in project2 you set the ellipsoid to "none/planimetric" you get the same values.

#2 Updated by Thomas Nogatz over 6 years ago

Now I understand. Thank you very much!
Best wishes, Thomas

Also available in: Atom PDF