rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
809 stars 507 forks source link

AddProviderTiles not working #546

Closed dpavancini closed 6 years ago

dpavancini commented 6 years ago

After upgrading do Leaflet 2.0.0, the addProviderTiles function stopped working in the R Studio Viewer. Only a grey empty map is shown. I've tried with a few different providers and the result is the same: image

leaflet() %>%
  leaflet::addProviderTiles(
    "CartoDB.Positron")

Inspecting the viewer, this is what I get :+1:

image

Any thoughts on that?

Grateful, Daniel

schloerke commented 6 years ago

Hi @dpavancini ,

Are you on linux? There is a known issue with https sources and RStudio on Linux (independent of leaflet). To fix this, you could download a daily build of RStudio (1.2.x) which fixes how it handles https.

-Barret

dpavancini commented 6 years ago

Hi @schloerke ,

Thanks for the reply. I'm on windows actually, below is my session info:

`R version 3.4.4 (2018-03-15) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252 LC_MONETARY=Portuguese_Brazil.1252 [4] LC_NUMERIC=C LC_TIME=Portuguese_Brazil.1252

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

other attached packages: [1] rlang_0.2.0.9001 tidyr_0.8.0 ggplot2_2.2.1.9000 sf_0.6-2 lattice_0.20-35
[6] scales_0.5.0.9000 RColorBrewer_1.1-2 leaflet.extras_1.0.0 shinyWidgets_0.4.2 shinyjs_1.0
[11] shinydashboard_0.7.0 leaflet_2.0.0.9000 geojsonio_0.6.0 httr_1.3.1 dplyr_0.7.4
[16] shiny_1.0.5 RPostgreSQL_0.6-2 DBI_1.0.0

loaded via a namespace (and not attached): [1] purrr_0.2.4 colorspace_1.3-2 V8_1.5 htmltools_0.3.6 yaml_2.1.19 e1071_1.6-8
[7] pillar_1.2.1 withr_2.1.2 foreign_0.8-69 glue_1.2.0.9000 sp_1.2-7 bindrcpp_0.2.2
[13] plyr_1.8.4 bindr_0.1.1 rgeos_0.3-26 gtable_0.2.0 munsell_0.4.3 htmlwidgets_1.2 [19] httpuv_1.3.6.2 maptools_0.9-2 crosstalk_1.0.0 curl_3.2 class_7.3-14 Rcpp_0.12.16
[25] xtable_1.8-2 udunits2_0.13 DT_0.4 classInt_0.2-3 jsonlite_1.5 mime_0.5
[31] digest_0.6.15 grid_3.4.4 jqr_1.0.0 rgdal_1.2-18 tools_3.4.4 magrittr_1.5
[37] lazyeval_0.2.1 geojson_0.2.0 tibble_1.4.2 pkgconfig_2.0.1 rsconnect_0.8.8 spData_0.2.8.3
[43] assertthat_0.2.0 R6_2.2.2 units_0.5-1 compiler_3.4.4 `

schloerke commented 6 years ago

@dpavancini Trying to narrow down if it's an https issue. Can you try these two code snippets ? I see a colored globe map (loaded over http).

leaflet() %>% addProviderTiles("Esri")

And an satellite image map of Africa, Asia, and Australia... (over a different https)

leaflet() %>% addProviderTiles("NASAGIBS.ModisTerraTrueColorCR")
dpavancini commented 6 years ago

I think it is really something about the https. The first map works fine: image

The second one shows the same grey screen and returns a SSL in R Studio. If I open it on the browser it works fine. Maybe is something broken on my R Studio installation?

Failed to load resource: Unable to init SSL Context: https://map1.vis.earthdata.nasa.gov/wmts-webmerc/MODIS_Terra_CorrectedReflectance_TrueColor/default//GoogleMapsCompatible_Level9/1/0/0.jpg

schloerke commented 6 years ago

Thank you for the help!

I'm going to close this issue for now as it is not a direct leaflet issue but rather a RStudio Desktop issue. I've submitted a bug report to them, and they have decided to wait it out in favor of RStudio Desktop v1.2.x.

For now, you can redirect all htmlwidgets to your browser with:

options("viewer" = function(url, ...) utils::browseURL(url))

or can install a daily build of RStudio Desktop which should solve the https issue.

-Barret

tim-salabim commented 6 years ago

Barret, on that note, would it be possible in a future version of leaflet to implement a way to specify the browser as described by @timelyportfolio in this issue? That would be highly appreciated!

abdulrr commented 2 years ago

Hi, has the issue about non-appearing tiles e.g., "CartoDB.Positron" occurred again, or is it just me? It only shows a grey screen. "Esri" tile works.

leaflet() %>%
    leaflet::addProviderTiles(
        "CartoDB.Positron")

Here is my sessionInfo()

`R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Finnish_Finland.1252  LC_CTYPE=Finnish_Finland.1252    LC_MONETARY=Finnish_Finland.1252
[4] LC_NUMERIC=C                     LC_TIME=Finnish_Finland.1252    

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

other attached packages:
[1] leaflet_2.1.1  mapview_2.11.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1        terra_1.5-17            remotes_2.4.2           purrr_0.3.4            
 [5] sf_1.0-6                lattice_0.20-41         colorspace_2.0-2        vctrs_0.3.8            
 [9] generics_0.1.2          leaflet.providers_1.9.0 htmltools_0.5.2         stats4_4.0.3           
[13] yaml_2.3.5              base64enc_0.1-3         utf8_1.2.2              rlang_1.0.1            
[17] e1071_1.7-9             pillar_1.7.0            glue_1.6.1              DBI_1.1.2              
[21] sp_1.4-6                RColorBrewer_1.1-3      lifecycle_1.0.1         munsell_0.5.0          
[25] raster_3.5-15           htmlwidgets_1.5.4       codetools_0.2-16        fastmap_1.1.0          
[29] crosstalk_1.2.0         curl_4.3.2              class_7.3-17            fansi_1.0.2            
[33] leafem_0.2.0            Rcpp_1.0.8              KernSmooth_2.23-17      scales_1.2.0           
[37] classInt_0.4-3          satellite_1.0.4         webshot_0.5.3           jsonlite_1.8.0         
[41] png_0.1-7               digest_0.6.29           dplyr_1.0.8             grid_4.0.3             
[45] cli_3.1.1               tools_4.0.3             magrittr_2.0.2          proxy_0.4-26           
[49] tibble_3.1.6            crayon_1.5.1            pkgconfig_2.0.3         ellipsis_0.3.2         
[53] assertthat_0.2.1        rstudioapi_0.13         R6_2.5.1                units_0.8-0            
[57] compiler_4.0.3