The following code produces a shiny app with (almost) the same output twice. One uses package "rcharts", the other package "leaflet"
The first map has a fullsreen button. Is this available with package leaflet()?
library(shiny)
library(rCharts)
library(leaflet)
runApp(
## UI ####
list(ui = (basicPage(
headerPanel("tests"),
mainPanel(
chartOutput("map1", "leaflet"),
"some text...",
leafletOutput('map2')
)
)),
## server ####
server = function(input, output) {
output$map1 <- renderMap({
map1 <- Leaflet$new()
map1$fullScreen(TRUE)
map1$setView(c(39.603609, -8.415081), 10)
map1
})
output$map2 <- renderLeaflet({
leaflet() %>%
addTiles() %>%
setView(lng = -8.415081, lat = 39.603609, zoom = 10)
})
}
))
Thanks
For future readers
With the package leaflet.extras
you can add a full screen control to your map.
library(leaflet)
library(leaflet.extras)
leaflet() %>%
addTiles() %>%
addFullscreenControl()
There is a plugin for the Leaflet javascript library called Leaflet.Control.FullScreen.
However, this plugin hasn't (yet) been implemented in the R version of leaflet
. I have posted a feature request on the leaflet
Github page, but haven't heard anything back so far.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With