mosaic2: Merge Raster* objects using a function for overlapping areas

mosaic2R Documentation

Merge ⁠Raster*⁠ objects using a function for overlapping areas

Description

Provides a wrapper around raster::mosaic() that cleans up any temporary intermediate files used, and sets the layer name of the resulting raster.

Usage

mosaic2(x, y, ...)

## S4 method for signature 'RasterLayer,RasterLayer'
mosaic2(
  x,
  y,
  ...,
  fun,
  tolerance = 0.05,
  filename = NULL,
  layerName = "layer",
  inRAM = FALSE
)

## S4 method for signature 'SpatRaster,SpatRaster'
mosaic2(
  x,
  y,
  ...,
  fun,
  tolerance = 0.05,
  filename = NULL,
  layerName = "layer",
  inRAM = FALSE
)

Arguments

x

⁠Raster*⁠ object

y

⁠Raster*⁠ object

...

Additional Raster or Extent objects.

fun

Function (e.g., mean, min, or max, that accepts a na.rm argument).

tolerance

Numeric. Permissible difference in origin (relative to the cell resolution). See all.equal().

filename

Character. Output filename (optional).

layerName

Character. Name of the resulting raster layer.

inRAM

Logical (default FALSE) indicating whether function operations should be performed in memory or, if TRUE, using temporary files.

Author(s)

Alex Chubaty


achubaty/amc documentation built on June 10, 2025, 1:10 p.m.