I am creating an app that allows the user to drop markers on the map. What I would like to do is show the user what markers they have dropped, and give them the option of downloading them. Whilst I could build another object to record historic map click information, shiny must be storing this information already. So, my question is fundamentally:
How do I extract the lat lon information from the marker_map object in the code?
OR
Where is all that marker lat lon information stored and how can I get it?
library(leaflet)
library(shiny)
ui <- fluidPage(
leafletOutput("mymap")
)
server <- function(input, output, session){
output$mymap <- renderLeaflet({
leaflet(options = leafletOptions(doubleClickZoom= FALSE)) %>%
setView(lng = 2, lat = 55, zoom = 5) %>%
addTiles()
})
observeEvent(input$mymap_click, {
click = input$mymap_click
marker_map <- leafletProxy('mymap') %>% addMarkers(lng = click$lng, lat = click$lat)
marker_map
})
}
shinyApp(ui, server)