Transforms a matrix
into a RasterLayer
object.
matrixToRaster(matrix, raster = NULL, projection = NULL)
A RasterLayer
a matrix object. See Details.
a RasterLayer
object whose extent and projection are used to
create a raster from matrix
.
a character vector providing a coordinate reference system.
Required when ncol(matrix)=3
.
When ncol(matrix)=3
, this function assumes that the first two
columns of argument matrix
provide coordinates to create a RasterLayer
,
hence argument projection
must be provided. When argument matrix
has
only 2 columns, then the argument raster
must be provided because its
coordinates
and projection
will be used
to rasterize matrix
.