[QGIS-Developer] QGIS gives different area calculation result compared to PROJ
Denis Rykov
rykovd at gmail.com
Fri Feb 19 03:17:05 PST 2021
from qgis.core import *
d = QgsDistanceArea()
d.setEllipsoid('WGS84')
lats = [-72.9, -71.9, -74.9, -74.3, -77.5, -77.4, -71.7, -65.9, -65.7,
-66.6, -66.9, -69.8, -70.0, -71.0, -77.3, -77.9, -74.7]
lons = [-74, -102, -102, -131, -163, 163, 172, 140, 113, 88, 59, 25,
-4, -14, -33, -46, -61]
g = QgsGeometry.fromPolygonXY([[QgsPointXY(lon, lat) for lon, lat in
zip(lons, lats)]])
d.measureArea(g)
and getting 13975013791223.5.
But if you look at pyproj example here:
https://github.com/pyproj4/pyproj/blob/8c57974177410909ec4eef2da3a60cbcda71acb8/pyproj/geod.py#L451
you can see that are of the same polygon is 13376856682207.4 so the
difference is quite big.
So I would say it seems like an error in the area calculation algorithm in QGIS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210219/01fcd767/attachment.html>
More information about the QGIS-Developer
mailing list