Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does leaflet output grey map?

Tags:

r

r-leaflet

I run simple examples of leaflet package in R like:

library(leaflet)
library(ggmap)

>somePlace <-ggmap::geocode("Vienna")  
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Vienna&sensor=false  
>somePlace 
lon      lat
1 16.37382 48.20817
>leaflet(somePlace) %>% addTiles() %>% addMarkers()

Map shows grey space with a blue marker:

enter image description here

No trace of OSM spatial visualisation. Could you point out where is the problem?

Thanks in advance for constructive discussion!

My configuration: R version 3.2.4 (2016-03-10), Platform: x86_64-w64-mingw32/x64 (64-bit), Windows Server 2012 x64 (build 9200), ggmap_2.6.1, leaflet_1.0.1.

Similar problems (but without a suitable solution): R leaflet package produces blank (grey) map [Ubuntu 14.04] R leaflet RStudio Viewer blank (grey) map [Windows 7]

like image 431
Patrik_P Avatar asked Nov 18 '25 11:11

Patrik_P


2 Answers

The answer to my own question is that the local firewall settings prevented me from downloading the tiles from OSM. The way how to solve it was to set proxy (from within R > link). The con of this solution is that the viewer still doesn`t deliver tiles as the proxy settings at the moment do not apply to RStudio Viewer. Although, the leaflet output appears properly in browser, therefore works also with Shiny Apps. Thanks for the support contributing to the solution!

like image 86
Patrik_P Avatar answered Nov 20 '25 02:11

Patrik_P


Your code is working in R 3.2.3 and also in RStudio. Let it load, it takes time. Before loading it looks like the screenshot you have pasted above.I am using Windows 10.

enter image description here

like image 36
Sowmya S. Manian Avatar answered Nov 20 '25 01:11

Sowmya S. Manian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!