Hi,
I have included a web page into a shiny app. This page allows me to check boxes to add transportation lines (buses or train) on a map on a selected territory.
I'd like to save the map in a PNG (or JPG or TIFF) file of the personalized map.
I expected using the appshot() function, but I only get the global map, without my choices.
Does anybody have a solution ?
Here is my shiny code :
Thanks in advance
# Réseau de transport en commun
library(shiny)
library(tidyverse)
library(webshot)
c_com <- "67300"
# Define UI for application
ui <- fluidPage(
# Application title
titlePanel("F L U O"),
# Sidebar with blabla
sidebarLayout(
sidebarPanel(
h6("Powered by: ")
# tags$img()
),
mainPanel(
checkboxInput("chk_export_6_3", "Export de la page"),
uiOutput("tb_local")
)
)
)
# Define server logic
server <- function(input, output) {
## lien vers Fluo
react_fluo44_local <- reactive(
str_c("https://www.fluo.eu/fr/plan-interactif-des-lignes/5",
"/LinesMap/FilterByLocality?LocalityId=",
c_com
) # str_c
)
output$tb_local <- renderUI({
h6("Page FLUO", br(),
tags$embed(src=react_fluo44_local(),
width = 1200,
height = 800)
)
}) # output
observeEvent(input$chk_export_6_3, {
if(isTRUE(input$chk_export_6_3)) {
nf <- "map_fluo.png"
# webshot::appshot(url = react_fluo44_local(),
# # webshot::webshot(url = output$tb_local, # ne marche pas
# file = nf, vwidth = 1200,
# vheight = 800,delay = 0
# )
} # end if
}
) # end ObserveEvent
} # server
# Run the application
shinyApp(ui = ui, server = server)