rasterXYMask.Rd 1.07 KiB
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/common.R
\name{rasterXYMask}
\alias{rasterXYMask}
\title{Raster mask by union of buffers around xy positions}
\usage{
rasterXYMask(xy, buff, r, binary = TRUE)
\arguments{
\item{xy}{2 columns matrix or data.frame. xy positions}
\item{buff}{vector.  buffers to apply to the xy positions}
\item{r}{raster object. target raster}
\item{binary}{boolean. should the output mask be boolean (TRUE) or greyscale (FALSE)}
\value{
a raster object
\description{
creates a raster mask by union of circular buffers around xy positions
\examples{
# create raster
r <- raster::raster()
raster::extent(r) <- c(0,40,0,40)
raster::res(r) <- 1
# xy positions
xy <- data.frame(x=c(10,20,31.25,15),
  y=c(10,20,31.25,25))
# compute mask
mask1 <- rasterXYMask(xy, c(5, 8, 5, 5), r)
mask2 <- rasterXYMask(xy, c(5, 8, 5, 5), r, binary=FALSE)
\dontrun{
# display binary raster
raster::plot(mask1)
graphics::points(xy)
# display distance raster
raster::plot(mask2)
graphics::points(xy)}
\seealso{
\code{\link{rasterChullMask}}