我在Rstudio上使用传单,但地图没有显示

时间:2016-06-20 09:18:40

标签: leaflet rstudio

我几天前开始学习有关光泽和传单的问题,这个问题可能无关紧要,但我找到了问题的答案,但没有发现任何问题。 好吧,我正在尝试创建一个交互式地图,其中包含我从互联网上获得的基本地图。我想在这张地图上代表全国各地一个指数的演变。

stypof <- readOGR(dsn = "C:/Users/N4XW6M/Desktop/nouvelle map/fonds typo propre.TAB", layer = "fonds typo propre", stringsAsFactors = FALSE)
names(stypof@data)<-c("typo") 

fond<-data.frame(stypof@data$typo)
names(fond)<-c("typo")
new_indice_mois <- sqldf("SELECT indice_mois.*
                         FROM indice_mois, fond
                         WHERE indice_mois.typo = fond.typo")


stypof$indice_fevrier <- new_indice_mois$indice_fevrier


leaflet(stypof) %>%
  addPolygons(
    stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5,
    color = ~colorQuantile("YlOrRd", stypof@data$indice_fevrier)(indice_fevrier)
  )

在第一步中,我使用readOGR导入基本地图。 有些区域没有在基本映射中表示,这就是我使用sqldf函数的原因,然后我将索引(indice_fevrier)添加到地图并尝试使用传单函数。 我没有得到任何错误消息只有一个空地图。 我尝试了一些我在互联网上找到的其他例子,我总是有同样的问题,地图没有出现。

1 个答案:

答案 0 :(得分:0)

根据此post,您必须点击“在新窗口中显示”才能显示地图。

相关问题