# NOT RUN {
# bounding box of Germany
bbox_GER <- c(5.86631529, 47.27011137, 15.04193189, 55.09916098)
bbox_GER_sf <- bbox_to_poly(bbox_GER)
library(ggplot2)
ggplot(bbox_GER_sf) +
geom_sf()
# }
# NOT RUN {
# Extract the bounding box of a sf object
Texas <- geo_lite_sf("Texas", points_only = FALSE)
bbox <- sf::st_bbox(Texas)
bbox
bbox_Texas <- bbox_to_poly(bbox)
ggplot(bbox_Texas) +
geom_sf(col = "red") +
geom_sf(data = Texas)
# }
Run the code above in your browser using DataLab