I'm trying to create a sliderInput animation using addWMSTiles in leaflet. However, the display is very choppy when the slider animation option is enabled.
In leaflet.extras there is an 'enableTileCaching' function for caching when adding tiles using 'addTiles', however I'm trying to cache WMS tiles to improve the display of a slider animation which calls WMS tiles for different time steps.
I've had a look at bindCache (Shiny package) and the memoise package, but haven't been able to find a solution for caching WMS tiles in leaflet.
This is my code for adding time step WMS layers, which is inserted within an observeEvent, where a change in the slider value updates the WMS layer.
observeEvent(input$slider, {
...
map_proxy2 %>%
clearGroup("test") %>% # <- clear earlier displayed layer
addWMSTiles(
baseUrl = UrlWMS,
layers = "precip",
#layerId = "",
group = "test",
attribution = "",
options = WMSTileOptions(format = "image/png", transparent = TRUE,
time = strftime(input$slider, format = "%Y-%m-%dT%H:%M:%SZ", tz = "GMT" ), zIndex = 50)
)
Any suggestions would be welcome.
Thanks
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS
other attached packages:
[1] leaflet.extras_1.0.0 lubridate_1.7.9.2 curl_4.3 RSQLite_2.2.2
[5] keyring_1.1.0 shinymanager_1.0.300 leafem_0.1.3 leaflet_2.0.3
[9] shinyBS_0.61 shinyTree_0.2.7 shinyjs_2.0.0 shinydashboardPlus_0.7.5
[13] shinydashboard_0.7.1 shinyWidgets_0.5.3 shiny_1.6.0