We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello!
is it possible to fill in the "layer_id" parameter of the function add_markers directly from a dataframe, just like "lat" and "lng" ?
add_markers
I know that we can do it with a for loop, but I try to use it in a shiny app and avoid for loops.
library(shiny) library(googleway) library(dplyr) map_key<- "***" ui <- fluidPage( sidebarLayout( sidebarPanel( actionButton(inputId = "addMarkers",label = "Add markers"), verbatimTextOutput("clikedLayer") ), mainPanel( div( tags$style(type = "text/css", "#map {height: calc(100vh - 5px) !important;}"), google_mapOutput("map")) ) ) ) server <- function(input, output, session) { df= data.frame(lat=c(45.1,45.2,45.3), lng=c(1.1,1.2,1.3), layer_id= c("id1","id2", "id3")) output$map <- renderGoogle_map({ google_map(key = map_key,geolocation = T, location = c(47.6062442,2.1148086), zoom = 10) }) observeEvent(input$addMarkers,{ google_map_update(map_id = "map") %>% googleway::add_markers(data = df, lat = "lat", lon = "lng", layer_id = "layer_id", update_map_view = T) output$clikedLayer<- renderPrint({ req(input$map_marker_click) print(input$map_marker_click) }) }) } shinyApp(ui = ui, server = server)
The text was updated successfully, but these errors were encountered:
id parameter did the job for me
id
Sorry, something went wrong.
I reopen because id can't be used to remove the marker using the function clear_markers we need layer_id
clear_markers
layer_id
is it possible to fill in the "layer_id" parameter of the function add_markers directly from a dataframe, just like "lat" and "lng"?
The layer_id can only be a single string, so I don't see how it can be filled in directly from a dataframe?
No branches or pull requests
Hello!
is it possible to fill in the "layer_id" parameter of the function
add_markers
directly from a dataframe, just like "lat" and "lng" ?I know that we can do it with a for loop, but I try to use it in a shiny app and avoid for loops.
The text was updated successfully, but these errors were encountered: