cell_width {restoptr}R Documentation

Compute the width of a cell

Description

Compute the width of a cell

Usage

cell_width(raster_layer, unit = "m")

Arguments

raster_layer

terra::rast() Raster object.

unit

unit object or a character that can be coerced to a unit (see unit package). Must be an length 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 width of a cell in the desired unit.

Examples


habitat_data <- rast(
  system.file("extdata", "habitat_hi_res.tif", package = "restoptr")
)
cell_width(habitat_data, "m")



[Package restoptr version 1.0.6 Index]