小编Con*_*rad的帖子

在ggplot地图上覆盖多边形

我正努力在谷歌地图上叠加邻居边界.我正在尝试遵循此代码.我的版本如下.你看到什么明显错了吗?

#I set the working directory just before this...
chicago = readOGR(dsn=".", layer="CommAreas")
overlay <- spTransform(chicago,CRS("+proj=longlat +datum=WGS84"))
overlay <- fortify(overlay)
location <- unlist(geocode('4135 S Morgan St, Chicago, IL 60609'))+c(0,.02)
ggmap(get_map(location=location,zoom = 10, maptype = "terrain", source = "google",col="bw")) +
  geom_polygon(aes(x=long, y=lat, group=group), data=overlay, alpha=0)+
  geom_path(color="red")
Run Code Online (Sandbox Code Playgroud)

任何见解都会非常感激.感谢您的帮助和耐心.

gis r shapefile ggplot2 ggmap

2
推荐指数
1
解决办法
6212
查看次数

标签 统计

ggmap ×1

ggplot2 ×1

gis ×1

r ×1

shapefile ×1