Returns a struct array with four point fields – x_min, x_max, y_min
and y_max – giving the coordinate that is furthest in each direction. The
result has one row per input geometry; a null or empty geometry yields a row
of four nulls.
Details
Note these are the extreme coordinates, not the corners of the bounding
box: the x_min point carries the y value of whichever vertex was
leftmost. Use ga_bounding_rect() for the envelope.
See also
Other boundary:
ga_bounding_rect(),
ga_concave_hull(),
ga_convex_hull(),
ga_minimum_rotated_rect()
Examples
fp <- system.file("shape/nc.shp", package = "sf")
nc <- as.data.frame(read_shapefile(fp))
# one row per county, four point columns
head(as.data.frame(ga_extremes(nc$geometry)), 3)
#> x_min x_max
#> 1 <POINT (-81.7410736 36.3917847)> <POINT (-81.2398911 36.3653641)>
#> 2 <POINT (-81.3475418 36.5379143)> <POINT (-80.9034424 36.5652122)>
#> 3 <POINT (-80.9657745 36.4672203)> <POINT (-80.4353104 36.5510445)>
#> y_min y_max
#> 1 <POINT (-81.4727554 36.2343559)> <POINT (-81.6699982 36.5896492)>
#> 2 <POINT (-81.2398911 36.3653641)> <POINT (-81.3452988 36.5728645)>
#> 3 <POINT (-80.874382 36.2338829)> <POINT (-80.9034424 36.5652122)>