getArea: Calculates the Area of a Raster.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/change_functions.R

Description

getArea reports the area of a RasterLayer object using the pixel counting method, or the area of a SpatialPolygons object using rgeos::gArea

Usage

1
getArea(x, value.to.count)

Arguments

x

Either a RasterLayer or SpatialPolygons object. For a RasterLayer, no data value should be NA

value.to.count

Optional. Value of the cells in a RasterLayer to be counted

Value

The total area of the cells of interest in km2

Author(s)

Nicholas Murray [email protected], Calvin Lee [email protected]

See Also

Other Change functions: getAreaLoss, getDeclineStats

Examples

1
2
3
4
crs.UTM55S <- '+proj=utm +zone=55 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
r1 <- raster(ifelse((volcano<130), NA, 1), crs = crs.UTM55S)
extent(r1) <- extent(0, 6100, 0, 8700)
a.r1 <- getArea(r1) # area of all non-NA cells in r1

nick-murray/redlistr documentation built on Oct. 11, 2018, 3:30 a.m.