Skip to contents

Returns the smallest rectangle of arbitrary rotation that contains each geometry, as a polygon array.

Usage

ga_minimum_rotated_rect(x)

Arguments

x

a GeoArrow geometry array

Value

a GeoArrow polygon array

References

MinimumRotatedRect

Examples

fp <- system.file("shape/nc.shp", package = "sf")
nc <- as.data.frame(read_shapefile(fp))

# ga_minimum_rotated_rect() can rotate, so it hugs the county tighter
rot <- ga_minimum_rotated_rect(nc$geometry)
head(as.vector(ga_unsigned_area(rot)), 3)
#> [1] 0.17296583 0.09121554 0.17446307
head(as.vector(ga_unsigned_area(ga_envelope(nc$geometry))), 3)
#> [1] 0.17806679 0.09215083 0.17575835