sprc function

Create a SpatRasterCollection

Create a SpatRasterCollection

Methods to create a SpatRasterCollection. This is an object to hold a collection (list) of SpatRasters. There are no restrictions on the similarity of the SpatRaster geometry.

They can be used to combine several SpatRasters to be used with merge or mosaic

You can create a SpatRasterCollection from a file with subdatasets. methods

## S4 method for signature 'character' sprc(x, ids=0, opts=NULL, raw=FALSE) ## S4 method for signature 'SpatRaster' sprc(x, ...) ## S4 method for signature 'list' sprc(x) ## S4 method for signature 'missing' sprc(x)

Arguments

  • x: SpatRaster, list with SpatRasters, missing, or filename
  • ids: optional. vector of integer subdataset ids. Ignored if the first value is not a positive integer
  • opts: character. GDAL dataset open options
  • raw: logical. If TRUE, scale and offset values are ignored
  • ...: additional SpatRasters

Returns

SpatRasterCollection

See Also

sds

Examples

x <- rast(xmin=-110, xmax=-50, ymin=40, ymax=70, ncols=60, nrows=30) y <- rast(xmin=-80, xmax=-20, ymax=60, ymin=30) res(y) <- res(x) values(x) <- 1:ncell(x) values(y) <- 1:ncell(y) z <- sprc(x, y) z
  • Maintainer: Robert J. Hijmans
  • License: GPL (>= 3)
  • Last published: 2025-02-26