sp_area: Function to calculate areas of spatial polygons in...

View source: R/sp_area.R

sp_areaR Documentation

Function to calculate areas of spatial polygons in metres-squared, kilometres-squared, or hectares.

Description

If the spatial-polygons are projected in a system with a metre unit, rgeos::gArea is used to calculate the area of the polygons. If the projection system is WGS84, a trigonometric function is used (geosphere::areaPolygon). Although using a projection system with metres yields the most accurate results, the geosphere::areaPolygon function has been tested and performs well.

Usage

sp_area(sp, unit = "m", features = TRUE)

Arguments

sp

Spatial-polygons object.

unit

Unit of returned area. Can be "m", "km", or "ha". Default is "m".

features

Should the individual areas of the features contained within sp be calculated? Default is TRUE.

Author(s)

Stuart K. Grange

Examples

## Not run: 
# Calculate the area of the Greater London Built-up area, sp is projected 
in OSGB36, a metric projection system

sp_area(sp_built_up_london, unit = "km")
1737.855

# Wikipedia says the same
# https://en.wikipedia.org/wiki/Greater_London_Built-up_Area

## End(Not run)


skgrange/gissr documentation built on June 20, 2024, 12:02 a.m.