Skip to contents

Functions to calculate different types of area for polygons.

Usage

signed_area(x)

unsigned_area(x)

signed_area_cd(x)

unsigned_area_cd(x)

signed_area_geodesic(x)

unsigned_area_geodesic(x)

Arguments

x

an object of class rsgeo

Value

a numeric vector of the area contained by the geometry

Details

  • functions assume counter clock-wise winding in accordance with the simple feature access standard

  • functions ending in _cd use the Chamberlain-Duquette algorithm for spherical area

  • Chamberlain-Duquette and Geodesic areas are returned in meters squared and assume non-planar geometries

See geo docs for more:

Examples

x <- c(0, 1, 1, 0, 0)
y <- c(0, 0, 1, 1, 0)
p <- geom_polygon(x, y)

signed_area(p)
#> [1] 1
unsigned_area(p)
#> [1] 1
signed_area_cd(p)
#> [1] 12391399902
unsigned_area_cd(p)
#> [1] 12391399902
signed_area_geodesic(p)
#> [1] 12308778361
unsigned_area_geodesic(p)
#> [1] 12308778361