简体   繁体   English

R4.0.0 中 RStudio 服务器和 Shiny 服务器中的 OpenStreetMaps 自动绘图错误

[英]OpenStreetMaps autoplot error in RStudio Server and Shiny Server in R4.0.0

I am getting a error when trying to plot OpenStreetMaps using autoplot in both RStudio Server and Shiny Server.在 RStudio 服务器和 Shiny 服务器中尝试使用自动绘图 plot OpenStreetMaps 时出现错误。

require(maps)
require(ggplot2)
require(OpenStreetMap)
mp <- openmap(c(53.38332836757155,-130.517578125),
c(15.792253570362446,-67.939453125),4,'stamen-watercolor')
mp_bing <- openmap(c(53.38332836757155,-130.517578125),
c(15.792253570362446,-67.939453125),4,'bing')
states_map <- map_data("state")
states_map_merc <- as.data.frame(
projectMercator(states_map$lat,states_map$long))
states_map_merc$region <- states_map$region
states_map_merc$group <- states_map$group
autoplot.osmtile 3
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
p <- autoplot(mp,expand=FALSE) + geom_polygon(aes(x=x,y=y,group=group),
data=states_map_merc,fill="black",colour="black",alpha=.1) + theme_bw()

The error is:错误是:

Error: Objects of type OpenStreetMap not supported by autoplot.错误:自动绘图不支持 OpenStreetMap 类型的对象。

I'm using version R 4.0.0.我正在使用版本 R 4.0.0。

Any insight would be great since this worked fine on R version 3.5.2 just fine on a different Shiny server.任何见解都会很棒,因为这在 R 版本 3.5.2 上运行良好,在不同的 Shiny 服务器上运行良好。

I had the same problem, too.我也有同样的问题。 Using OpenStreetMap::autoplot.OpenStreetMap() instead of ggplot2::autoplot() , I managed to obtain an attached image:使用OpenStreetMap::autoplot.OpenStreetMap()而不是ggplot2::autoplot() ,我设法获得了附加图像:

附图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM