Really useful function to define bounding box enveloppe

bbox_polygon(shp, buffer = 0)

Arguments

shp

sf or sfc object that we want to bound within some box

buffer

dist to add around the bounding box to avoid the weird boundary effects

Value

st_polygon forming a box

Details

See https://stackoverflow.com/questions/45719790/create-voronoi-polygon-with-simple-feature-in-r

Examples

if (FALSE) {
shp_trees <-  st_read('https://www.donneesquebec.ca/recherche/dataset/bc5afddf-9439-4e96-84fb-f91847b722be/resource/bbdca0dd-82df-42f9-845b-32348debf8ab/download/vdq-arbrepotentielremarquable.geojson')
shp_trees %>% bbox_polygon()
}