我正在尝试使用plot_sf
从openstreemap中绘制shapefile,但是却出现了空白。这是我正在尝试的:
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)
答案 0 :(得分:1)
这对我有用。与您的几乎相同:
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)