OpenStreetMap doesn't display in RStudio (with

2019-03-06 04:39发布

I am using code from here

library(leaflet)

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

A point appears in the middle of the screen, but no map. Then I found package to download, i.e. osmar, and included that, i.e.

library(osmar)

And map is still not displaying. How to fix?

enter image description here

Update

I am able to access openstreetmap.com on my web browser. Javascript is enabled. Some places they mentioned use setView to display openstreetmap but when I try, the screen is now blank, no pop-up pointer

library(osmar)
library(leaflet)

m <- leaflet() %>%
  addTiles() %>%  
  setView(174.768, lat=-36.852, zoom=18)
m

1条回答
够拽才男人
2楼-- · 2019-03-06 05:15

I had the same issue, found this and worked very well for me:

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

found it here: https://gis.stackexchange.com/questions/187926/leaflet-output-is-grey

查看更多
登录 后发表回答