View source: R/change_functions.R
getArea | R Documentation |
getArea
reports the area of a RasterLayer object using the pixel
counting method, or terra::expanse for SpatRaster and SpatVector objects,
or the area of a SpatialPolygons or sf object using sf::st_area
getArea(x, ...)
x |
Either a RasterLayer or SpatialPolygons object. For a RasterLayer, no data value should be NA |
... |
Addition arguments based on input format |
The total area of the cells of interest in km2
Nicholas Murray murr.nick@gmail.com, Calvin Lee calvinkflee@gmail.com
Other Change functions:
getArea.RasterLayer()
,
getArea.SpatRaster()
,
getArea.SpatVect()
,
getArea.SpatialPolygons()
,
getArea.sf()
,
getAreaLoss()
,
getDeclineStats()
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.