1

Is there a way to add popups when the user clicks a feature using the mapdeck in R? I am plotting Origin-Destination arcs using add_arc

m <- mapdeck(token = key, style = 'mapbox://styles/mapbox/dark-v9') %>%
  add_arc(
    data = lf
    , layer_id = "arc_layer"
    , origin = c("geometry.x")
    , destination = c("geometry.y")
  )

I want the user to be able to view information about each arc (specifically the origin, destination, and # of passengers, which is all included in the lf data frame) when they click on it. I'm having a hard time figuring out how this could be done if at all as I don't see a whole lot of info on mapdeck outside of the documentation. I see javascript solutions to this, but I am not sure how I could apply these in R?

For example: https://docs.mapbox.com/mapbox-gl-js/example/popup-on-hover/ shows how to add popups on hover using js.

I did notice the tooltip parameter which creates a popup on hover, but I am wondering if it's possible to do a popup on click.

If anyone knows either how to add these popups using the mapdeck package itself, or how to integrate js code into the mapdeck code, that would be greatly appreciated!

nkt95
  • 65
  • 4
  • This is not currently possible in the package itself, but I've added it as a [feature request](https://github.com/SymbolixAU/mapdeck/issues/343) – SymbolixAU Mar 20 '21 at 02:34

0 Answers0