I'm working on an app that needs to load in a bigger shapefile to render in a leaflet map.
output$map<-renderLeaflet({
withProgress(message = 'Loading Map Data',
detail = 'Please be patient this may take a while...', value = 0, {
for (i in 1:60) {
incProgress(1/60)
Sys.sleep(0.25)
}
})
leaflet() %>%
setView(lng = -93.85, lat = 37.45, zoom = 4)%>%
addGeoJSON(states, group = "state count")%>%
addPolygons(data = county_data, stroke = F, fillOpacity = 0.5, #smoothfactor = 0.5,
group = "county count",
color = ~colorQuantile("Greens", county_data$Count)(Count))%>%
addPolygons(data = county_data, stroke = F, fillOpacity = 1, #smoothfactor = 0.5,
group = "county heat",
color = ~colorQuantile("YlOrRd", county_data$A298th)(A298th))
})
The problem is that the progress bar works finishes and then the map renders. So with the progress bar the map takes MUCH longer to render upwards of 20 seconds. (i.e. progress bar runs for about 15 seconds) then disappears and it's another 10 seconds before the map appears. Without the progress bar sometimes the map will render in 8 seconds. I think 8 seconds is too long for the user to wait. Any ideas what's going on here?