I'm extracting data from OpenStreetMap using osmdata
, and from the query I get a set of points, lines, polygons, and multipolygons. Somehow, when trying to plot multipolygons, leaflet and tmap do not find them, while using plot(st_geometry(...))
works well.
Any ideas as to what is happening?
library(osmdata)
library(sf)
library(tmap)
nkpg_schools <-
opq(bbox = "Norrköping") %>%
add_osm_feature(key = "amenity", value = "school") %>%
osmdata_sf()
plot(st_geometry(nkpg_schools$osm_multipolygons)) #Works well
tmap_mode("view")
tm_basemap("Esri.WorldGrayCanvas") +
tm_shape(nkpg_schools$osm_multipolygons) +
tm_polygons()
#Does not work