将传单图层的弹出窗口传递给有光泽的textOutput

时间:2017-07-11 23:39:28

标签: r shiny leaflet

在一个闪亮的应用程序中,是否可以将选定的传单图层的弹出值传递给leafletOutput外部的textOutput?我遇到了this answered question似乎在问同样的事情,但在答案中他们似乎停止将layerId打印到控制台。除了" lat"还有什么方法可以访问任何其他信息吗? " LNG"和" id",例如弹出窗口?

这基本上是我被困的地方:

popup <- paste0("County Name: ", counties$NAME, "<br>", 
                "Population: ", counties$POP, "<br>", 
                "Unemployment Percentage: ", counties$UNEMP
         )
ID <- as.vector(counties$CNTY_ID)

map2 <-leaflet() %>%
 addPolygons(data = counties, layerId = ID, popup = popup
 )

observe({
event <- input$map2_shape_click

# I'm assuming what I need to do goes here

if (is.null(event))
  return()
print(event)      
})

output$popupOut <- renderText(event)

0 个答案:

没有答案