easyprintMap {leaflet.extras2} | R Documentation |
easyprintMap
Description
Print or export a map programmatically (e.g. in a Shiny environment).
Usage
easyprintMap(map, sizeModes = "A4Portrait", filename = "map")
Arguments
map |
the map widget |
sizeModes |
Must match one of the given |
filename |
Name of the file if |
Value
A leaflet map object
See Also
Other EasyPrint Functions:
addEasyprint()
,
easyprintOptions()
,
removeEasyprint()
Examples
## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(leaflet)
library(leaflet.extras2)
ui <- fluidPage(
leafletOutput("map"),
selectInput("scene", "Select Scene", choices = c("CurrentSize", "A4Landscape", "A4Portrait")),
actionButton("print", "Print Map")
)
server <- function(input, output, session) {
output$map <- renderLeaflet({
input$print
leaflet() %>%
addTiles() %>%
setView(10, 50, 9) %>%
addEasyprint(options = easyprintOptions(
exportOnly = TRUE
))
})
observeEvent(input$print, {
leafletProxy("map") %>%
easyprintMap(sizeModes = input$scene)
})
}
shinyApp(ui, server)
}
[Package leaflet.extras2 version 1.2.2 Index]