Learn R Programming

geosphere (version 1.1.2)

areaPolygon: Compute the area of a polygon

Description

Compute the area of a polygon on a sphere

Usage

areaPolygon(xy, r=6378137)

Arguments

xy
Longitude/latitude of the points forming a polygon; Must be a matrix of 2 columns (first one is longitude, second is latitude) or a SpatialPolygons* object
r
radius of the earth; default = 6378137 m

Value

  • Area. Unit is the square of the unit of r.

Examples

Run this code
xy <- rbind(c(-180,-20), c(-140,55), c(10, 0), c(-140,-60), c(-180,-20))
areaPolygon(xy)

Run the code above in your browser using DataLab