matrix_to_raster: matrix_to_raster

View source: R/matrix_to_raster.R

matrix_to_rasterR Documentation

matrix_to_raster

Description

Convert matrix to raster

Usage

matrix_to_raster(
  matrix,
  landscape = NULL,
  landscape_empty = FALSE,
  extent = NULL,
  resolution = NULL,
  crs = NULL,
  to_disk = getOption("to_disk", default = FALSE)
)

Arguments

matrix

matrix with values.

landscape

SpatRaster

landscape_empty

If true, SpatRaster is landscape_empty

extent

Extent of SpatRaster

resolution

Resolution of SpatRaster

crs

CRS of raster layer.

to_disk

If TRUE raster will be saved to disk.

Details

Converts matrix to a raster with same characteristics as landscape. Either landscape or extent, resolution and crs must be specified.

Value

raster

Examples

augusta_nlcd <- terra::rast(landscapemetrics::augusta_nlcd)

test_matrix <- terra::as.matrix(augusta_nlcd, wide = TRUE)
matrix_to_raster(matrix = test_matrix, landscape = augusta_nlcd)


landscapemetrics documentation built on Sept. 12, 2024, 7:42 a.m.