Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在GGR地图上覆盖osmar形状?_R_Google Maps_Osmar - Fatal编程技术网

如何在GGR地图上覆盖osmar形状?

如何在GGR地图上覆盖osmar形状?,r,google-maps,osmar,R,Google Maps,Osmar,我无法用R将osmar形状覆盖在ggmap上 我得到osmar对象(在本例中,它是威斯康星州密尔沃基的湖泊公园): 然后我尝试将其覆盖在地图上: area.points <- fortify(lpp) mapImage <- get_map(location = c(lon = -87.89, lat = 43.05), color = "color", source = "google", zoom = 13) ggmap(mapImage) + geom_

我无法用R将osmar形状覆盖在ggmap上

我得到osmar对象(在本例中,它是威斯康星州密尔沃基的湖泊公园):

然后我尝试将其覆盖在地图上:

area.points <- fortify(lpp)
mapImage <- get_map(location = c(lon = -87.89, lat = 43.05),  color = "color",           source = "google",  zoom = 13)
ggmap(mapImage) + geom_path(aes(x=long,y=lat), data=area.points, color=colors[9], alpha=0.5)+labs(x="Longitude", y="Latitude")

area.points在geom_路径的aes部分添加
group=group
,解决了以下问题:

ggmap(mapImage) + geom_path(aes(x=long,y=lat,group=group), data=area.points, 
                            color=colors[9], alpha=0.5)+
                  labs(x="Longitude", y="Latitude")
[plot(lpp)][1]
area.points <- fortify(lpp)
mapImage <- get_map(location = c(lon = -87.89, lat = 43.05),  color = "color",           source = "google",  zoom = 13)
ggmap(mapImage) + geom_path(aes(x=long,y=lat), data=area.points, color=colors[9], alpha=0.5)+labs(x="Longitude", y="Latitude")
ggmap(mapImage) + geom_path(aes(x=long,y=lat,group=group), data=area.points, 
                            color=colors[9], alpha=0.5)+
                  labs(x="Longitude", y="Latitude")