r - Leaflet Layer Tiles not switchable when .html (= .Rmd output) is opened with browser -
for several days now, basic layer tiles "osm" , "stamen.tonerlite" (which i've been using on year standard tiles maps) not shown correctly – i.e. it's not possible anymore switch between them.
as long map shown in rstudio , rstudio viewer, works perfectly. however, open corresponding .html-file of .rmd-output in browser (i tried chrome, internet explorer, edge , firefox), it's not possible anymore switch between tiles. either "osm" shown , can't switch "stamen.tonerlite" or vice versa.
i've tried different layer tiles or more 2 layer tiles, same result. there's 1 layer tile visible when switch others.
reproducible example 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 ```
try this, point pipe in 2 provider tiles addtiles() argument
--- 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 ```
Comments
Post a Comment