makeTiles: Make tiles

makeTilesR Documentation

Make tiles

Description

Divide a SpatRaster into "tiles". The cells of another SpatRaster (normally with a much lower resolution) or a SpatVector with polygon geometry can be used to define the tiles. You can also provide one or two numbers to indicate the number of rows and columns per tile.

Usage

## S4 method for signature 'SpatRaster'
makeTiles(x, y, filename="tile_.tif", extend=FALSE, na.rm=FALSE, overwrite=FALSE, ...)

Arguments

x

SpatRaster

y

SpatRaster, SpatVector, or numeric

filename

character. Output filename template. Filenames will be altered by adding the tile number for each tile

extend

logical. If TRUE, the extent of y is expanded to assure that it covers all of x

na.rm

logical. If TRUE, tiles with only missing values are ignored

overwrite

logical. If TRUE, existing tiles are overwritten; otherwise they are skipped (without error or warning)

...

additional arguments for writing files as in writeRaster

Value

character (filenames)

See Also

vrt to create a virtual raster from tiles

Examples

r <- rast(ncols=100, nrows=100)
values(r) <- 1:ncell(r)
x <- rast(ncols=2, nrows=2)
filename <- paste0(tempfile(), "_.tif")
ff <- makeTiles(r, x, filename)
ff

vrt(ff)

terra documentation built on Oct. 13, 2023, 5:08 p.m.