Identify each Marker individually

  observe({  click = input$mapa_marker_click
  if(is.null(click))
    return()
  else
    
    my_list <- list()
    r <- 1
if(click$id== "Free")
{
my_route <- viaroute(click$lat,click$lng,df_map$lat[4], df_map$lng[4]) 
  geom <- decode_geom(my_route$routes[[1]]$geometry)
  my_list[[r]] <- geom
  my_list2<-as.data.frame(my_list)
  leafletProxy("mapa") %>%
    addPolylines(lng=my_list2$lng,lat=my_list2$lat, layerId = df_map$id)}})

How to identify each Marker individually?
I'm trying to create an if so that if the name of the Marker is equal to "Free" the function calculates a specific route. and if it's another name, the function does something else, but I have a problem, I can't identify each CircleMarker individually... How can I do this? is there any way to access a Circlemarker?

Yes, you can identify each marker. You need to assign an unique identifier via layerId.

Consider something along the lines of this example: Shiny: Using multiple exclusive reactiveValues for filtering dataset

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.