Compute buffer to a region.
compute_buffer_region(region, direction = "in", size)
region | An |
---|---|
direction | "in" for buffers that are contained within |
size | Distance to determine which neighboring trees to a focal tree are
competitors. The units are assumed to be the same as the |
An sf
polygon object of buffer
Other spatial functions:
add_buffer_variable()
,
focal_vs_comp_distance()
library(tibble) library(sfheaders) library(ggplot2) # Example square region to be buffered (as sf object) region <- tibble( x = c(0, 0, 1, 1), y = c(0, 1, 1, 0) ) %>% sf_polygon() # Size of buffer size <- 0.05 # Compute "inwards" buffer inwards_buffer_region <- region %>% compute_buffer_region(direction = "in", size = size) # Compute "outwards" buffer outwards_buffer_region <- region %>% compute_buffer_region(direction = "out", size = size) # Plot all three regions: ggplot() + geom_sf(data = outwards_buffer_region, col = "blue", fill = "transparent") + geom_sf(data = region, fill = "transparent") + geom_sf(data = inwards_buffer_region, col = "orange", fill = "transparent") + labs(title = "Regions: original (black), inwards buffer (orange), and outwards buffer (blue)")