-
Notifications
You must be signed in to change notification settings - Fork 87
/
makeTiles.Rd
63 lines (43 loc) · 2.16 KB
/
makeTiles.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
\name{makeTiles}
\docType{methods}
\alias{getTileExtents}
\alias{getTileExtents,SpatRaster-method}
\alias{makeTiles}
\alias{makeTiles,SpatRaster-method}
\title{Make tiles or get their extents}
\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.
\code{getTileExtents} returns the extents of the (virtual) tiles, while \code{makeTiles} creates files for the tiles and returns their filenames.
}
\usage{
\S4method{makeTiles}{SpatRaster}(x, y, filename="tile_.tif", extend=FALSE,
na.rm=FALSE, buffer=0, overwrite=FALSE, ...)
\S4method{getTileExtents}{SpatRaster}(x, y, extend=FALSE, buffer=0)
}
\arguments{
\item{x}{SpatRaster}
\item{y}{SpatRaster, SpatVector, or numeric}
\item{filename}{character. Output filename template. Filenames will be altered by adding the tile number for each tile}
\item{extend}{logical. If \code{TRUE}, the extent of \code{y} is expanded to assure that it covers all of \code{x}}
\item{na.rm}{logical. If \code{TRUE}, tiles with only missing values are ignored}
\item{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. \code{\link{focal}}. The expansion is only inside \code{x}, no rows or columns outside of \code{x} are added}
\item{overwrite}{logical. If \code{TRUE}, existing tiles are overwritten; otherwise they are skipped (without error or warning)}
\item{...}{additional arguments for writing files as in \code{\link{writeRaster}}}
}
\value{
character (filenames) or matrix (extents)
}
\seealso{
\code{\link{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)
}
\keyword{methods}
\keyword{spatial}