Title: | Fast, Dependency-Free Geodesic Area Calculations |
---|---|
Description: | Dependency-free, ultra fast calculation of geodesic areas, using the the reference nanometre-accuracy libraries of Karney (2013) <doi:10.1007/s00190-012-0578-z>, as used by the 'sf' package. The main function accepts a single input of two columns containing the longitude and latitude coordinates, assumed to be a polygon and represented in WSG84 projection, and returns the area in square metres, and perimeter in metres. |
Authors: | Mark Padgham [aut, cre], Charles F.F Karney [cph] (Original author of included code for geodesic distances) |
Maintainer: | Mark Padgham <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1.007 |
Built: | 2024-11-06 05:13:16 UTC |
Source: | https://github.com/hypertidy/geoarea |
Calculation is based on the "geographiclib" code of Charles Karney <doi:10.1007/s00190-012-0578-z>, available at https://github.com/geographiclib/geographiclib-c. These calculations are available in many other libraries and R packages, and are notably included in the 'PROJ' library, and used by many packages which depend on that library, including sf. The geosphere package also includes the C++ version of this code, but depends on the obsolete sp package.
geoarea(x, spherical = FALSE)
geoarea(x, spherical = FALSE)
x |
Rectangular object (matrix, |
spherical |
If 'TRUE', calculate approximate area presuming spherical geometry, using method of Bevis and Cambareri (1987) <doi:10.1007/BF00897843>. |
In contrast to all other implementations, this function performs no pre-processing or input checking whatsoever, and simply aims to provide the fastest way to calculate areas of polygons expressed in longitudes and latitudes.
A vector of two numbers quantifying the area and perimter of the polygon 'x'. The 'cheap = TRUE' method does not calculate perimeters, and resturns 'NA' for the second value.
# Perimeter of Antarctica as documented in original 'geographiclib' code lats <- c (-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 <- c (-74, -102, -102, -131, -163, 163, 172, 140, 113, 88, 59, 25, -4, -14, -33, -46, -61) xy <- cbind (lons, lats) geoarea (xy)
# Perimeter of Antarctica as documented in original 'geographiclib' code lats <- c (-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 <- c (-74, -102, -102, -131, -163, 163, 172, 140, 113, 88, 59, 25, -4, -14, -33, -46, -61) xy <- cbind (lons, lats) geoarea (xy)