简体   繁体   English

R传单包产生空白(灰色)图[Ubuntu 14.04]

[英]R leaflet package produces blank (grey) map [Ubuntu 14.04]

I tried out the examplecode from the leaflet package doc: 我尝试了leaflet包doc中的examplecode:

devtools::install_github("rstudio/leaflet");library(leaflet)
m <- leaflet() %>%
  addTiles() %>%  # Add default OpenStreetMap map tiles
  addMarkers(lng=174.768, lat=-36.852,
             popup="The birthplace of R")
m  # Print the map

but it only produced a grey, blank map in the RStudio Viewer, as well as in my Firefox 38.0. 但它在RStudio Viewer和Firefox 38.0中只生成了灰色的空白地图 Maybe this has something to do with Ubuntu? 也许这与Ubuntu有关?

Here my sessionInfo: 这里我的sessionInfo:

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C  C_TIME=de_DE.UTF-8   
    C_COLLATE=de_DE.UTF-8     LC_MONETARY=de_DE.UTF-8   
[6] LC_MESSAGES=de_DE.UTF-8    LC_PAPER=de_DE.UTF-8 
 LC_NAME=C  LC_ADDRESS=C     LC_TELEPHONE=C           
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] leaflet_1.0.0.9999 rgdal_0.9-2        sp_1.0-17         

loaded via a namespace (and not attached):
[1] Rcpp_0.11.5        magrittr_1.5       devtools_1.7.0
MASS_7.3-41        munsell_0.4.2      colorspace_1.2-6   
lattice_0.20-31   
[8] stringr_0.6.2      httr_0.6.1         plyr_1.8.1  
tools_3.2.1        grid_3.2.1         gtable_0.1.2       
tmltools_0.2.6   [15] yaml_2.1.13        digest_0.6.8        
JSONIO_1.3-0      RColorBrewer_1.1-2 reshape2_1.4.1     
gplot2_1.0.1      htmlwidgets_0.3.2 
[22] bitops_1.0-6       RCurl_1.95-4.5     scales_0.2.5   
proto_0.3-10      

I had this issue, but there was no proxy issues (I was admin, it was at home etc) The basemap showed for me in RStudio, but not in html. 我遇到了这个问题,但是没有代理问题(我是管理员,在家里等)。底图在RStudio中为我显示,但在HTML中却没有。

The solution is simply reminding leaflet what the basemap is. 解决方法是简单地提醒传单底图是什么。 It defaults to OSM in RStudio output, but then didn't export it with html. 它在RStudio输出中默认为OSM,但随后未使用html导出。

I simply added the tag 我只是添加了标签

%>% addProviderTiles(providers$OpenStreetMap) %>% 

Use 采用

names(providers)

to see all providers of basemaps. 查看底图的所有提供者。

I had the same problem. 我有同样的问题。

Resolved for me by specifying urlTemplate parameter in addTiles() : 通过在addTiles()指定urlTemplate参数为我解决了:

library(leaflet)
leaflet() %>% 
  addTiles(urlTemplate = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')

I get the same thing. 我也一样 Same happens for me when I am work. 我上班时也会遇到同样的情况。 I think that the corporate IT dept. 我认为公司的IT部门。 is blocking certain network traffic. 正在阻止某些网络流量。 Try it again at home. 在家里再试一次。

Hope that helps. 希望能有所帮助。

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

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