I am trying to build a map of a federate state in germany with special borders (voting districts):
install.packages("OpenStreetMap")
install.packages("sf")
install.packages("osmdata")
install.packages("tmap")
library(OpenStreetMap)
library(sf)
library(osmdata)
library(tmap)
## I use this because the other overpass server didnt work that well
set_overpass_url("https://overpass-api.de/api/interpreter")
##open the map of "baden-württemberg" and get the right boundaries, timeout is increased because the map is big and it sometimes timed out
boundaries <- opq(bbox = getbb("baden-württemberg"), timeout = 900) %>%
add_osm_feature(key = 'admin_level', value = '6') %>%
add_osm_feature(key = "boundary", value = "administrative") %>%
osmdata_sf() %>% unique_osmdata()
qtm(boundaries$osm_multipolygons)
I get
Error in do.call(rbind, x) : variable names are limited to 10000 bytes
It should approxamitly look something like this:
boundaries <- opq(bbox = 'Brussels, Belgium') %>%
add_osm_feature(key = 'admin_level', value = '8') %>%
osmdata_sf %>% unique_osmdata
municipalities <- boundaries$osm_multipolygons
qtm(municipalities)
with the resulting plot:
[