qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.65k stars 3.01k forks source link

Field Calculator Uses Original Units After Layer Reprojection #59571

Closed changlu12 closed 4 hours ago

changlu12 commented 5 hours ago

What is the bug or the crash?

After reprojecting a layer in QGIS, the layer properties correctly display the units of the new coordinate system. However, when using the Field Calculator to calculate geometry, the calculations still use the units of the original coordinate system, resulting in incorrect outputs.

Steps to reproduce the issue

  1. Load a layer into QGIS with an initial coordinate system that uses feet as the unit (e.g., EPSG:2277).
  2. Use the "Reproject Layer" function to transform the layer to another coordinate system that uses meters as the unit (e.g., EPSG:32633).
  3. Verify in the layer properties that the units have been updated to meters according to the new coordinate system.
  4. Use the Field Calculator with the $area or $length function to calculate geometry. The results still use the original units (feet) instead of the units of the new projection (meters).

Versions

QGIS 3.38.3

Supported QGIS version

New profile

Additional context

No response

agiudiceandrea commented 4 hours ago

@changlu12, please read the User Guide / Manual:

13.2.13.4. $area https://docs.qgis.org/3.34/en/docs/user_manual/expressions/functions_list.html#area

The area calculated by this function respects both the current project’s ellipsoid setting and area unit settings.

13.2.13.58. $length https://docs.qgis.org/3.34/en/docs/user_manual/expressions/functions_list.html#length

The length calculated by this function respects both the current project’s ellipsoid setting and distance unit settings.

Use the area and length function instead.

Feel free to reopen this issue report if you think you found an actual bug: in this case please describe the issue with more details.