scale_by_pixel_area: Scales a raster by the area of each pixel in meters

Description Usage Arguments Value

View source: R/pixel_areas.R

Description

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.

Usage

1
2
3
4
5
6
7
scale_by_pixel_area(
  x,
  filename,
  datatype,
  pixel_areas = NULL,
  scale_factor = 1
)

Arguments

x

a Raster* object

filename

(optional) filename for output raster

datatype

(optional) datatype for output raster see dataType NOT YET SUPPORTED

pixel_areas

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.

scale_factor

a value to scale the results by

Value

RasterLayer with pixel areas (in meters)


gfcanalysis documentation built on July 1, 2020, 6:06 p.m.