如何结合 ggplot2 和 autoplot.OpenStreetMap

问题描述 投票:0回答:0

我无法在一系列点下显示 osm 地图。

shapefile 包含在数据框 (df) 中。

当我运行这段代码时,

df <- st_as_sf(df, coords = c("Longitude", "Latitude")) 
ggplot(df) + geom_sf() + theme_void()

我得到这个结果:

当我运行这段代码时,

dc <- openmap(c(19.353014580954277,-99.14118184937192), 
                    c(19.287683266903073,-99.03186392856783), 
                    zoom = NULL,
                    type = "osm", 
                    mergeTiles = TRUE)
autoplot.OpenStreetMap(dc) + theme_void()

我得到这个结果:

我已经尝试了多种方法并阅读了很多教程和备忘单,但仍然不明白如何将这两者结合起来创建一个图像,

r ggplot2 openstreetmap sf
© www.soinside.com 2019 - 2024. All rights reserved.