mosaic_input: Create and Export mosaics

View source: R/utils_mosaic.R

mosaic_inputR Documentation

Create and Export mosaics

Description

Create and Export mosaics

Usage

mosaic_input(mosaic, ...)

mosaic_export(mosaic, filename, overwrite = FALSE, ...)

Arguments

mosaic
  • For mosaic_input(), a file path to the raster to imported, a matrix, array or a list of SpatRaster objects.

  • For mosaic_export(), an SpatRaster object.

...

Additional arguments passed to terra::rast() (mosaic_input()) or terra::writeRaster() (mosaic_output())

filename

character. The Output filename.

overwrite

logical. If TRUE, filename is overwritten.

Details

  • mosaic_input() is a simply wrapper around terra::rast(). It creates a SpatRaster object from scratch, from a filename, or from another object.

  • mosaic_export() is a simply wrapper around terra::writeRaster(). It write a SpatRaster object to a file.

Value

  • mosaic_input() returns an SpatRaster object.

  • mosaic_export() do not return an object.

Examples

library(pliman)

# create an SpatRaster object based on a matrix
x <- matrix(1:20, nrow = 4, ncol = 5)
rast <- mosaic_input(x)
mosaic_view(rast, viewer = "base", axes = TRUE)

# create a temporary filename for the example
f <- file.path(tempdir(), "test.tif")
mosaic_export(rast, f, overwrite=TRUE)
list.files(tempdir())


pliman documentation built on Oct. 15, 2023, 1:06 a.m.

Related to mosaic_input in pliman...