Calculates the area (in meters) of each pixel in a raster, scales the value
of each pixel by the area, applies the desired scale factor, and returns the
result as a RasterLayer
. Useful for calculating class areas based on
a classified raster in a geographic coordinate system. Assumes that raster
is not rotated (latitudes of every pixel in a given row are identical).
Processes block by block to support handling very large rasters.
scale_by_pixel_area(
x,
filename,
datatype,
pixel_areas = NULL,
scale_factor = 1
)
RasterLayer
with pixel areas (in meters)
a Raster*
object
(optional) filename for output raster
(optional) datatype for output raster see
dataType
NOT YET SUPPORTED
a vector giving the area of each cell in a single column
of the raster. See calc_pixel_areas
. If NULL, this vector will
be calculated based on the coordinate system of x
.
a value to scale the results by