raster_chull_mask | R Documentation |
creates raster mask corresponding to the convex hull of xy positions
raster_chull_mask(xy, r)
xy |
2 columns matrix or data.frame. xy positions |
r |
raster object. target raster |
a SpatRaster with 0 or 1
raster_xy_mask
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.