Hi,
I have a leaflet map that is powered by osmdata. I have tried to apply this in a shiny app. The app runs but the map does not appear.
library(osmdata)
library (sf)
library(rgdal)
library(leaflet)
x <-opq(bbox=c(-3.845215,51.041394,4.658203,58.642653),timeout = 25*1000)%>%
add_osm_feature("plant:source","wind") %>%
osmdata_sf()
ui <- fluidPage(
mainPanel(leafletOutput("myMap")),
headerPanel("Asset Header"),
sidebarPanel()
)
server<-function(input,output){
output$map<-renderLeaflet
({
map= leaflet()%>%addTiles()%>%addPolygons(data=x,
popup = paste("Name:",x$Project.Name,"<br/>"))
output$myMap = renderLeaflet(map)
})
}
shinyApp(ui = ui, server = server)
Is there a reason the leaflet map does not appear?
Should I query osm everytime or should I save the data locally via *.rds?
Thanks