nb_cell_to_area {restoptr} | R Documentation |
Compute the area corresponding to a given number of cells.
Description
Compute the area corresponding to a given number of cells.
Usage
nb_cell_to_area(raster_layer, nb_cells, unit = "ha")
Arguments
raster_layer |
|
nb_cells |
|
unit |
|
Details
The input raster must have a projected coordinate system. The distortion is
not corrected. It could be using the cellSize
function of the terra
package, but this function is currently pretty slow for large rasters. If
your problem is at regional scale, the distortion should be negligible.
However, at larger scales, the best is to use an equal-area projected
coordinate system.
Value
numeric
The area corresponding to nb_cells
in the desired unit.
Examples
habitat_data <- rast(
system.file("extdata", "habitat_hi_res.tif", package = "restoptr")
)
nb_cell_to_area(habitat_data, 20, unit = "ha")
[Package restoptr version 1.0.6 Index]