[Qgis-user] Different values for $area and 'Add Geometry Attributes'

Andrea Giudiceandrea andreaerdna at libero.it
Fri Mar 14 10:48:49 PDT 2025


Il 14/03/2025 15:38, Jochen Albrecht ha scritto:
> Thank you, Andrea. But let me reiterate that the layer is projected, so 
> the default should in either case be to apply the algorithm.
> $area does not allow me to specify projection parameters. But by playing 
> with that option for the other tool, I found that the erroneous value is 
> based on ellipsoidal calculations - regardless of whether a planimetric 
> project CRS has been defined or not.
> Can you think of a way to override this behavior for $area?

Hi Jochen,
not sure to understand your question.

Area and length measurements can be performed either on the Cartesian 
plane of the CRS or on the ellipsoid.

If a valid ellipsoid is the for the project [1], then the "$area" 
function calculates the area on such ellipsoid, regardless of whether 
the layer's or the project's CRS is a geographic or projected one.
If the ellipsoid is set to "None/Planimetric", then the "$area" function 
will return the value of the area measured on the layer's CRS Cartesian 
plane (regardless of whether the layer's or the project's CRS is a 
geographic or projected one).

Instead, the "area" function always calculates the value of the 
planimetric area measured on the layer's CRS Cartesian plane (regardless 
of whether the layer's or the project's CRS is a geographic or projected 
one and regardless a valid ellipsoid is the for the project).

Thus, if you want to calculate the planimetric area on the Cartesian 
plane of the layer's CRS using an expression, then you can just use the 
"area" function. For the same purpose, you can also use the "$area" 
function, ensuring the project's ellipsoid is set to "None/Planimetric".

Regards.

Andrea


[1] 
https://docs.qgis.org/3.40/en/docs/user_manual/introduction/qgis_configuration.html#general-properties


More information about the QGIS-User mailing list