How can I read marker data in a brilliant brochure

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/")
####load data converted in geojson
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
    )
  ),



))

enter image description here

+4
source share
2 answers

I believe you want to see:

input$map_marker_click

The bquast reference examples are used input$map_shape_click but this is based on the basic GeoJSON data contained in the downloaded brochure.

You can use the information returned map_marker_clickto request your data and insert it into a pop-up window.

+4
source

All Articles