Convert a RasterLayer object into a worldMatrix object or a RasterStack object into a worldArray object.

raster2world(raster, method)

# S4 method for RasterLayer,character
raster2world(raster, method)

# S4 method for RasterStack,character
raster2world(raster, method)

Arguments

raster

RasterLayer or RasterStack object.

method

"ngb" or "bilinear" for the resample method.

Value

WorldMatrix or worldArray object depending on the input raster. Patches value are retained from the raster.

Details

See help("worldMatrix-class") or help("worldArray-class") for more details on the classes.

The raster is resampled to match the coordinates system and resolution of a worldMatrix or worldArray using the chosen method. The extent will be bigger by 1 on the width and on the height.

Examples

r1 <- raster(extent(c(0, 10, 0, 10)), nrows = 10, ncols = 10) r1[]<-runif(100) w1 <- raster2world(r1, method = "ngb") plot(r1)
plot(w1)