Learn R Programming

insetplot (version 1.4.0)

get_widest_bbox: Compute the union bounding box from multiple shapes

Description

Calculates the overall bounding box that encompasses all provided spatial shapes.

Usage

get_widest_bbox(shapes)

Value

A named numeric vector with elements: ymin, xmin, xmax, ymax

representing the union of all input bounding boxes.

Arguments

shapes

A list of sf objects.

Examples

Run this code
library(sf)

# Load sample data
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)

# Get the bounding box of the entire dataset
bbox <- get_widest_bbox(list(nc))
bbox

Run the code above in your browser using DataLab