USAID-OHA-SI / gisr

OHA Geospatial Analytics Utilities
https://usaid-oha-si.github.io/gisr/
MIT License
2 stars 0 forks source link

Get extent as data frame #26

Open baboyma opened 5 months ago

baboyma commented 5 months ago

Convert extent to data frame:

st_bbox(spdf_cnty) %>%
    as.list() %>%
    as_tibble() %>%
    pivot_longer(everything()) %>%
    mutate(axis = str_sub(name, 1, 1),
           name = str_remove(name, "x|y")) %>%
    pivot_wider(names_from = axis, values_from = value)