1

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) 

pm9602
  • 23
  • 5
  • Do you want to show lat and long for all markers or just the last one that was created? Did you check [this answer](https://stackoverflow.com/questions/28938642/marker-mouse-click-event-in-r-leaflet-for-shiny) for example? – bretauv Apr 02 '20 at 14:17
  • I want to record all markers. I dont have trouble with recording the data per se, its more that I want to know where that data is being stored (if it is being stored) and how to access it without having to create yet another object. – pm9602 Apr 02 '20 at 14:30

0 Answers0