Reputation: 3486
I am trying to use plot_sf
to plot shapefile from openstreemap, but I get a blank plot. Here is what I am trying:
library("osmdata")
#> Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
bb <- getbb("Sevilla")
q <- opq(bb)
q <- q %>% add_osm_feature(key = "highway", value = "motorway")
q1 <- opq_string(q)
dt <- osmdata_sf(q1)
sf::plot_sf(dt$osm_lines)
Upvotes: 1
Views: 282
Reputation: 1708
This works for me. Pretty much the same as yours:
library(osmdata)
library(sf)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
bb <- getbb("Sevilla")
q <- opq(bb)
q <- q %>% add_osm_feature(key = "highway", value = "motorway")
q1 <- opq_string(q)
dt <- osmdata_sf(q1)
plot(dt)
dt$osm_lines
plot(dt$osm_lines)
Upvotes: 1