makeTiles | R Documentation |
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.
getTileExtents
returns the extents of the (virtual) tiles, while makeTiles
creates files for the tiles and returns their filenames.
## S4 method for signature 'SpatRaster'
makeTiles(x, y, filename="tile_.tif", extend=FALSE,
na.rm=FALSE, buffer=0, overwrite=FALSE, ...)
## S4 method for signature 'SpatRaster'
getTileExtents(x, y, extend=FALSE, buffer=0)
x |
SpatRaster |
y |
SpatRaster or SpatVector defining the zones; or numeric specifying the number of rows and columns for each zone (1 or 2 numbers if the number of rows and columns is not the same) |
filename |
character. Output filename template. Filenames will be altered by adding the tile number for each tile |
extend |
logical. If |
na.rm |
logical. If |
buffer |
integer. The number of additional rows and columns added to each tile. Can be a single number, or two numbers to specify a separate number of rows and columns. This allows for creating overlapping tiles that can be used for computing spatial context dependent values with e.g. |
overwrite |
logical. If |
... |
additional arguments for writing files as in |
character (filenames) or matrix (extents)
vrt
to create a virtual raster from tiles and crop
for sub-setting arbitrary parts of a SpatRaster.
r <- rast(ncols=100, nrows=100)
values(r) <- 1:ncell(r)
x <- rast(ncols=2, nrows=2)
getTileExtents(r, x)
getTileExtents(r, x, buffer=3)
filename <- paste0(tempfile(), "_.tif")
ff <- makeTiles(r, x, filename)
ff
vrt(ff)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.