I play with the elevator in a brilliant app and I would like information about the marker that I click on. At the moment I have a good map with a marker, but how can I return information about the marker that I click on?
my .R server
library(shiny)
library(leaflet)
library(rgdal)
setwd("~/github/shiny_stuff/banyuls_map/")
capteurs<-readOGR("./data/capteurs.geojson", "OGRGeoJSON")
shinyServer(function(input, output, session) {
map <- createLeafletMap(session, "map")
session$onFlushed(once=TRUE, function() {
map$addMarker(capteurs@coords[,2],
capteurs@coords[,1]
)
})
})
my ui.R
library(shiny)
library(leaflet)
shinyUI(fluidPage(
titlePanel("title panel"),
leafletMap(
"map", "100%", 400,
initialTileLayer = "//{s}.tiles.mapbox.com/v3/jcheng.map-5ebohr46/{z}/{x}/{y}.png",
initialTileLayerAttribution = HTML('Maps by <a href="http://www.mapbox.com/">Mapbox</a>'),
options=list(
center = c(42.4797, 3.1181),
zoom = 12
)
),
))

source
share