Sheet tile sheets do not switch when .html (=. Rmd output) opens in a browser

For several days, the main layers of the "OSM" and "Stamen.TonerLite" layers (which I have been using as standard fragments for my maps for more than a year) are not displayed correctly, i.e. switch between them.

As long as the map is displayed in RStudio and RStudio Viewer, everything works fine. However, as soon as I open the corresponding .html .Rmd output file in the browser (I tried chrome, Internet Explorer, edge and firefox), it is no longer possible to switch between the plates. Either "OSM" is displayed, and I cannot switch to "Stamen.TonerLite" or vice versa.
I tried different layer tiles or more than two layers, but with the same result. Only one layer is always displayed, even if I switch to others.

A reproducible example for my case:

---
title: "stackoverflow"
author: " "
date: " "
output: html_document
---

```{r, echo = T}
library(leaflet)

m <- leaflet() %>%
     addTiles(group = "OSM") %>%
     addProviderTiles("Stamen.TonerLite") %>%
     addLayersControl(baseGroups = c("OSM", "Stamen.TonerLite")) %>%
     addCircleMarkers(lat = 47.4,
                      lng = 9.37,
                      radius = 10,
                      fillOpacity = 1.0)
m
```

enter image description here

enter image description here

+4
source share
1 answer

, , addTiles()

---
title: "stackoverflow"
author: " "
date: " "
output: html_document
---

```{r, echo = T}
library(leaflet)

m <- leaflet() %>%
 addTiles() %>%
 addProviderTiles(providers$OpenStreetMap, group = "OSM") %>%
 addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
 addLayersControl(baseGroups = c("OSM", "Toner Lite")) %>%
 addCircleMarkers(lat = 47.4,
                  lng = 9.37,
                  radius = 10,
                  fillOpacity = 1.0)
m
```
+4

Source: https://habr.com/ru/post/1682489/


All Articles