[GIS] QGIS area calculation differs when on the fly CRS transformation enabled

areacoordinate systemqgis

When I open QGIS, add the layer, and calculate the areas of the shapefile via field calculator I get a different area than when I open QGIS and check "Enable on the fly CRS transformation" and calculate the area. This is despite making sure that the project and the layer have the same Coordinate system (same EPSG number). What am I doing wrong?

I have a shapefile with area calculations made with ArcGIS (not be me, the data was handed to me and I have no clue for which CRS the area was calculated with ArcGIS). The shapefile layer CRS is EPSG: 21781 (Switzerland). In QGIS, if I do not change the OTF settings and leave the project CRS as EPSG:4326 (WGS84) I get the same value as the ArcGIS area value. However, if I change the OTF before adding the layer to EPSG: 21781 I get different area values. As I understand this suggests that ArcGIS Area was calculated with the CRS EPSG: 4326.

First workflow:

  1. open QGIS
  2. project CRS: EPSG 4326
  3. add layer
  4. project CRS adapts automatically and is EPSG 21781 now
  5. calculate $area with field calculator

Second workflow:

  1. open QGIS
  2. project CRS: EPSG 4326
  3. Turn on OTF, set project CRS to EPSG 21781
  4. add layer
  5. calculate $area with field calculator

Step 5 of the first and second workflow DO NOT produce the same area.

Best Answer

EDIT - Disclaimer: I would like to refer the readers to the discussion with ChrisW below. It might be that getting an area based upon an OTF CRS is not a bug after all; that is, at least, in arcgis it also being used to allow geoprocessing two layers from different CRS.

To elaborate on the issue above. As AndreJ as suggested and show - this is probably a bug in qgis's current version. Yet it should be noted that the problem isn't the wrong area, but that on-the-fly transformation affects in anyway on area calculations.

The purpose of on-the-fly transformation/projection is to align data from different sources and with different CRS. That is mainly for display purposes. E.G. arcmap automatically perform on-the-fly projection in any case a layer CRS does not match the data frame CRS.

Arcmap also provides a possibility to edit data while projected on-the-fly, but also notes that: (source)

However, it is important to note that certain editing operations may produce unexpected alignment or accuracy problems, depending on the coordinate systems being used.

Specific editing operations that may cause issues include changing the shapes of features, snapping to the edge or boundary of features, or extending and trimming features. These problems are more likely to occur when the features you are editing are close to the edge or beyond the area of use of the coordinate system

That is to say: on the fly transformation is less acurate than just project the data to a different CRS (which also introduces its own problems).

Having said that it is not surprising that based on a on-the-fly transformation a wrong area is being calculated, yet it is surprising that the fact that on-the-fly was enabled affects in any way the calculation of geometry, which should be based on the data. Thus, it doesn't matter if on-the-fly transformation is based upon the same or a different CRS, area calculation should be identical each time.

To be more practical, if your aim is to compute the area do not use on-the-fly. If you have the wrong CRS, project your data.

Related Question