Package leaflet - map doesn't show

谁说胖子不能爱 提交于 2020-01-05 05:36:07

问题


I got some question about the package "leaflet" which I'm using with Rstudio.

My problem is, that the basemap isn't shown. But at the bottom of the viewer is written "OpenStreeMap" and the options to zoom in and out are also shown.

Somebody knows about this problem?

library(leaflet)
m <- leaflet()
m <- addTiles(m)
m <- addMarkers(m, lng=174.768, lat=-36.852, popup="The birthplace of R")
m

The easy example is shown here: https://rstudio.github.io/leaflet/


回答1:


If you are behind a proxy try to add provider info

library(leaflet)
m <- leaflet() %>%
  addTiles(urlTemplate = "http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png", 
       attribution = '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>')
m



回答2:


I have a solution: If I click in RStudio on "Show in new Window" the map opens in the browser and there I can see it.

Maybe the map only work in the browser?



来源:https://stackoverflow.com/questions/37812844/package-leaflet-map-doesnt-show

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!