inst/examples/shiny/bouncemarkers.R

library(shiny)
library(leaflet)
library(leaflet.extras)

greenLeafIcon <- makeIcon(
  iconUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png",
  iconWidth = 38, iconHeight = 95,
  iconAnchorX = 22, iconAnchorY = 94,
  shadowUrl = "http://leafletjs.com/examples/custom-icons/leaf-shadow.png",
  shadowWidth = 50, shadowHeight = 64,
  shadowAnchorX = 4, shadowAnchorY = 62
)

ui <- fluidPage(
  leafletOutput("map")
)

server <- function(input, output, session) {
  output$map <- renderLeaflet({
    leaflet() %>%
      addTiles() %>%
      addBounceMarkers(data = breweries91, label = ~address,
                       popup = ~brewery,
                       icon = greenLeafIcon)
  })
}
shinyApp(ui, server)
bhaskarvk/leaflet.extras documentation built on April 23, 2024, 9:32 a.m.