Learn R Programming

terra (version 0.2-9)

buffer: buffer

Description

Calculate a buffer around all cells that are not NA in a SpatRaster, or around the objcts in a SpatVector (t.b.d.)

Note that the distance unit of the buffer width parameter is meters if the SpatRaster CRS is (+proj=longlat), and in map units (typically also meters) if not.

Usage

# S4 method for SpatRaster
buffer(x, width=0, filename="", overwrite=FALSE, wopt=list(), ...)

Arguments

x

SpatRaster

width

numeric > 0. Unit is meter if x has a longitude/latitude CRS, or mapunits in other cases

filename

character. Output filename. Optional

overwrite

logical. If TRUE, filename is overwritten

wopt

list. Options for writing files as in writeRaster

...

Additional arguments. None implemented

Value

SpatRaster

See Also

distance

Examples

Run this code
# NOT RUN {
r <- rast(ncol=36,nrow=18)
v <- rep(NA, ncell(r))
v[500] <- 1
values(r) <- v
b <- buffer(r, width=5000000) 
#plot(b)
# }

Run the code above in your browser using DataLab