CalCOFI / capstone

Capstone project for CCDSP fellowship, where we will store data and code
1 stars 2 forks source link

How to capture station when clicked? #66

Closed PK0207 closed 2 years ago

PK0207 commented 2 years ago

Hey @bbest ! Leaflet currently records station line and number and is able to display it on a pop-up window when clicked. We would like to record them as inputs. We currently use a dropdown menu to select line ID which is slow and unintuitive.

image

bbest commented 2 years ago

You'll want to check out Inputs/Events in Leaflet for R - Using Leaflet with Shiny, eg input$map1_shape_click and capture with observe, eg for superzip-example (code):

  # When map is clicked, show a popup with city info
  observe({
    leafletProxy("map") %>% clearPopups()
    event <- input$map_shape_click
    if (is.null(event))
      return()

    isolate({
      showZipcodePopup(event$id, event$lat, event$lng)
    })
  })