1

I tried showing $area of polygons in QGIS, and it always showed planimetric square degrees instead of metric units. No matter what I set in project general settings, the value remained the same.

QGIS version is 3.4.3, layer CRS is 4326, and I tried different CRS in the project, which made no difference.

I calculated a new field with the formula: $area / 10000 (to get hectares, which is more readable). And looking it up in Wikipedia, the city area is close to that and is rather correct.

So, you can get $area but have to use field calculator. Is there a workaround to make $<function> work correctly in labels?

enter image description here

Following suggestions by @MAP: the derived tab in object properties is always correct...

enter image description here

...But the reason I'm asking is that the function description promises to work this way too:

enter image description here

...while simple area(geometry) is always planimetric.

  • Which CRS (EPSG) uses your QGIS project? (as shown down right in the status bar) – MAP Jan 1 at 21:18
  • @MAP: it's 3857. Changing it also does not make any difference. – culebrón Jan 1 at 21:27
  • Try: Compare the results in the "derived" tab in the Identify Results window for one country. There are two calculations based on ellipsoidal / cartesian surface – MAP Jan 1 at 21:30
  • @MAP I did, those are always correct. – culebrón Jan 1 at 21:43
  • It seems that the area(geometry) function in the label expression ignores the properties of the project but of the layer. It can be solved with the transform(geom, source_auth_id, dest_auth_id) function. What version of QGIS are you using? What is the coordinate reference system of the layer? – Gabriel De Luca Jan 1 at 22:54
1

I also see that the function always calculates the planimetric area in the labeling.

A possible solution (I do not consider it robust but at least possible) is to reproject the polygons in the World_Cylindrical_Equal_Area CRS (EPSG:54034).

Since the spatial reference of the vector layer is the geographic system WGS 84 (EPSG: 4326), the transform function can be included in the labeling expression to reproject the geometry and calculate the area at the time of labeling:

'$area in calculator:' || ar || '\n$area in label:' || round( area( transform( $geometry, 'EPSG:4326', 'EPSG:54034') ) / 10000, 4) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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