Learn R Programming

frheritage (version 0.1.0)

geo_extent: Compute bounding boxes for each feature in an sf object

Description

This internal helper computes the bounding box (left, bottom, right, top) for each feature in an sf object.

Usage

geo_extent(x, crs = 4326)

Value

A data.frame where each row corresponds to a feature's bounding box, with columns left, bottom, right, top.

Arguments

x

An sf object (POLYGON or MULTIPOLYGON) for which to compute bounding boxes.

crs

Numeric, Code of the target CRS. Default is 4326.

Details

  • The function first validates the input with geo_object_check().

  • Transforms the object to the target CRS before computing bounding boxes.

  • CRS and units are inherited from the input sf object.