I will run more tests to find out what may be causing this issue but the
problem is solved for now.
Thank you!
Em seg., 27 de set. de 2021 ?s 12:32, Roger Bivand <Roger.Bivand at nhh.no>
escreveu:
On Mon, 27 Sep 2021, Rik Ferreira wrote:
Dear list members,
Why does sf::st_area returns a different area than the output of QGIS
for the same geometry?
A reproducible example (state of Minas Gerais, Brazil):
library(sf)
mg <- geobr::read_state(31)
st_area(mg)
sf::st_area: 588358849314 [m^2]
QGIS $area: 586521037474,860 m?
The layer used in QGIS was exported with st_write() in GeoJSON format.
The error is: 1837811840 m?.
Spherical geometry (s2) switched off
Spherical geometry (s2) switched on
1837966275 [m^2]
See https://r-spatial.org/r/2020/06/17/s2.html
When sf_use_s2() is FALSE, see ?st_area ("ellipsoidal distances are
computed using st_geod_distance which uses function 'geod_inverse' from
GeographicLib (part of PROJ)"). You'd have to establish what code QGIS
uses to know why it and GeographicLib differ.
Hope this clarifies
Roger
Thank you for the attention.
Att.