These functions use the geodesic formula for computing area and perimeter on an ellipsoidal model of the earth. They return area in square meters and perimeter in meters.
Details
geo assumes Simple Features winding, so it expects an exterior ring to run
counter-clockwise. ga_unsigned_area_geodesic() reads a clockwise ring as
the rest of the earth instead and returns a value near 5.1e14. For
shapefiles, which wind clockwise, orient with ga_orient() first or read
the sign off ga_signed_area_geodesic(), which does not have this problem.
See also
Other area:
ga_perimeter_euclidean(),
ga_signed_area(),
ga_signed_area_cd()
Examples
fp <- system.file("shape/nc.shp", package = "sf")
nc <- as.data.frame(read_shapefile(fp))
head(as.vector(ga_signed_area_geodesic(nc$geometry)))
#> [1] -1137389166 -611077451 -1423490699 -694546681 -1520741303 -967728604
head(as.vector(ga_perimeter_geodesic(nc$geometry)))
#> [1] 141665.2 119928.6 160497.5 301517.1 211952.3 160891.0
# orient nc, which winds clockwise, before taking the unsigned area
ccw <- ga_orient(nc$geometry, "default")
head(as.vector(ga_unsigned_area_geodesic(ccw)))
#> [1] 1137389166 611077451 1423490699 694546681 1520741303 967728604