raster_chull_mask {lidaRtRee}R Documentation

Raster mask of convex hull

Description

creates raster mask corresponding to the convex hull of xy positions

Usage

raster_chull_mask(xy, r)

Arguments

xy

2 columns matrix or data.frame. xy positions

r

raster object. target raster

Value

a SpatRaster with 0 or 1

See Also

raster_xy_mask

Examples

# create raster
r <- terra::rast(extent = c(0, 40, 0, 40), resolution = 1, crs = "epsg:2154")


# xy positions
xy <- data.frame(
  x = c(10, 20, 31.25, 15),
  y = c(10, 20, 31.25, 25)
)
# compute mask
mask1 <- raster_chull_mask(xy, r)

# display binary raster
terra::plot(mask1)
graphics::points(xy)

[Package lidaRtRee version 4.0.5 Index]