Hi,

I wonder what method QGIS is using when it computes ellipsoidal area with $area 
function. I made a test with this EPSG:4326 polygon:
POLYGON (( 20.13293641 59.95688345, 26.94617837 60.47397663, 29.74782155 
62.56499443, 27.45254202 68.7065034, 23.75771765 68.24937206, 25.42698984 
65.27444593, 21.51545237 63.10353609, 21.4056276 61.12318104, 19.41123592 
60.40477513, 20.13293641 59.95688345 ))

I checked that the CRS of the project and layer were both EPSG:4326. The 
ellipsoid in the Project-Settings was WGS 84 (EPSG:7030). The area that $area 
returns is
249566957499.7546

As a references I used PostGIS and web site 
https://geographiclib.sourceforge.io/scripts/geod-calc.html#area. With my test 
polygon they both give this result:
251199344354.4308

PostGIS returns bigger area. The difference is 0.654% so not huge but not 
negligible either.

A third test with SpatiaLite 5.0 gives a result that is very close to PostGIS 
(difference 0.001%).
251195856999.549927

As a conclusion I have decided to trust in PostGIS because it gives the same 
results than the web site 
https://geographiclib.sourceforge.io/scripts/geod-calc.html that feels 
scientifically sound. However, I wonder if I have used QGIS in a correct way or 
if there is anything I could do for getting areas to match better with PostGIS 
for example by densifying the long segments in my test polygon.

For getting testing easy I attach directly runnable  SQL for PostGIS and 
Spatialite (version 5.0 with RTTopo is needed) as well as a coordinate list for 
the web app.

PostGIS
select st_area(st_geogfromtext('POLYGON ((
20.13293641   59.95688345,
26.94617837   60.47397663,
29.74782155   62.56499443,
27.45254202   68.70650340,
23.75771765   68.24937206,
25.42698984   65.27444593,
21.51545237   63.10353609,
21.40562760   61.12318104,
19.41123592   60.40477513,
20.13293641   59.95688345))') , true);

Spatialite
select st_area(st_geomfromtext('POLYGON ((
20.13293641   59.95688345,
26.94617837   60.47397663,
29.74782155   62.56499443,
27.45254202   68.70650340,
23.75771765   68.24937206,
25.42698984   65.27444593,
21.51545237   63.10353609,
21.40562760   61.12318104,
19.41123592   60.40477513,
20.13293641   59.95688345))') ,true);

Web site (notice lat-lon order)
59.95688345 20.13293641
60.47397663 26.94617837
62.56499443 29.74782155
68.70650340 27.45254202
68.24937206 23.75771765
65.27444593 25.42698984
63.10353609 21.51545237
61.12318104 21.40562760
60.40477513 19.41123592
59.95688345 20.13293641

-Jukka Rahkonen-
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to