worldMatrix
or worldArray
object into a SpatRaster
objectR/world-functions.R
world2spatRast.Rd
Convert a worldMatrix
object or a
worldArray
object into a SpatRaster
object
world2spatRast(world)
# S4 method for worldMatrix
world2spatRast(world)
# S4 method for worldArray
world2spatRast(world)
WorldMatrix
or worldArray
object.
SpatRaster
object.
Patches
value are retained from the world
.
The SpatRaster
returned has the same extent and resolution as the world
with round coordinates at the center of the cells and coordinates x.5
at the edges of the cells.
w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9, data = runif(100))
r1 <- world2spatRast(w1)
terra::plot(r1)
w2 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9, data = 0)
w3 <- stackWorlds(w1, w2)
r3 <- world2spatRast(w3)
terra::plot(r3)