Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

misc-gArea

Area of Geometry


Description

Calculates the area of the given geometry.

Usage

gArea(spgeom, byid=FALSE)

Arguments

spgeom

sp object as defined in package sp

byid

Logical determining if the function should be applied across subgeometries (TRUE) or the entire object (FALSE)

Value

Returns the area of the geometry in the units of the current projection. By definition non-[MULTI]POLYGON geometries have an area of 0. The area of a POLYGON is the area of its shell less the area of any holes. Note that this value may be different from the area slot of the Polygons class as this value does not subtract the area of any holes in the geometry.

Author(s)

Roger Bivand & Colin Rundel

See Also

Examples

gArea(readWKT("POINT(1 1)"))
	gArea(readWKT("LINESTRING(0 0,1 1,2 2)"))
	gArea(readWKT("LINEARRING(0 0,3 0,3 3,0 3,0 0)"))
	
	
	p1 = readWKT("POLYGON((0 0,3 0,3 3,0 3,0 0))")
	p2 = readWKT("POLYGON((0 0,3 0,3 3,0 3,0 0),(1 1,2 1,2 2,1 2,1 1))")
	
	gArea(p1)
	p1@polygons[[1]]@area
	
	gArea(p2)
	p2@polygons[[1]]@area

rgeos

Interface to Geometry Engine - Open Source ('GEOS')

v0.5-5
GPL (>= 2)
Authors
Roger Bivand [cre, aut] (<https://orcid.org/0000-0003-2392-6140>), Colin Rundel [aut], Edzer Pebesma [ctb], Rainer Stuetz [ctb], Karl Ove Hufthammer [ctb], Patrick Giraudoux [ctb], Martin Davis [cph, ctb], Sandro Santilli [cph, ctb]
Initial release
2020-09-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.