Last active
June 13, 2018 06:15
-
-
Save tim-salabim/870f9a4af76f6dda5940e62f9e0d2209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(osmdata) | |
library(mapview) | |
library(sf) | |
q0 <- opq(bbox = "Bern, Switzerland", timeout = 60) | |
q1 <- add_osm_feature(q0, key = 'building', value = "hospital") | |
x <- osmdata_sf(q1) | |
pols_ctr = st_centroid(x$osm_polygons) | |
buff = st_buffer(pols_ctr, dist = 0.0015) | |
fin_pols = st_union(buff) %>% st_cast("POLYGON") | |
mapview(fin_pols) + pols_ctr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment