generate_bbox {sigugr}R Documentation

Generate a Bounding Box as an sf Object

Description

Takes an 'sf' object or a 'terra::SpatRaster' as input and returns a new 'sf' object representing the bounding box (minimum bounding rectangle) of the input layer.

Usage

generate_bbox(layer)

Arguments

layer

An 'sf' object or a 'terra::SpatRaster' object.

Value

An 'sf' object representing the bounding box of the input layer.

See Also

Other clip functions: clip_layer(), clip_multipoligon(), clip_raster()

Examples

# Example with a vector layer
source_gpkg <- system.file("extdata/sigugr.gpkg", package = "sigugr")
lanjaron <- sf::st_read(source_gpkg, layer = "lanjaron", quiet = TRUE)
bbox_vector <- generate_bbox(lanjaron)

# Example with a raster layer
raster_file <- system.file("extdata/sat.tif", package = "sigugr")
raster <- terra::rast(raster_file)
bbox_raster <- generate_bbox(raster)


[Package sigugr version 1.0.0 Index]