Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

matrix_to_raster

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

RasterLayer.

landscape_empty

If true, RasterLayer is landscape_empty

extent

Extent of RasterLayer.

resolution

Resolution of RasterLayer.

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

test_matrix <- raster::as.matrix(augusta_nlcd)
matrix_to_raster(matrix = test_matrix, landscape = augusta_nlcd)

landscapemetrics

Landscape Metrics for Categorical Map Patterns

v1.5.2
GPL-3
Authors
Maximillian H.K. Hesselbarth [aut, cre] (<https://orcid.org/0000-0003-1125-9918>), Marco Sciaini [aut] (<https://orcid.org/0000-0002-3042-5435>), Jakub Nowosad [aut] (<https://orcid.org/0000-0002-1057-3721>), Sebastian Hanss [aut] (<https://orcid.org/0000-0002-3990-4897>), Laura J. Graham [ctb] (Input on package structure), Jeffrey Hollister [ctb] (Input on package structure), Kimberly A. With [ctb] (Input on package structure), Florian Privé [ctb] (Original author of underlying C++ code for get_nearestneighbour() function), Project Nayuki [ctb] (Original author of underlying C++ code for get_circumscribingcircle and lsm_p_circle), Matt Strimas-Mackey [ctb] (Bugfix in sample_metrics())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.