Open bastianmanz opened 7 years ago
I just run into the very same problem. Have you found a solution in the end?
Maybe, use Developer Tools in Chrome (Ctrl+Shift+I) to disable network cache while you're testing / editing your WMS layers.
Hey mbacou, thanks for your response. Good idea to start with. I disabled network cache in Chromium and Firefox without any changes in the behaviour in the map (i.e. the map still requires a trigger to change to the recently displayed layer)..
In the meantime, I also tried to disable caching on the GeoServer side via unchecking Tilecaching > Caching default > Automatically configure a GeoWebCache layer for each new layer or layer group
. As this didn't change anything, I attempted to disable caching on the layer level via uncheckingEdit layer > Tile caching > Create a cached layer for this layer
--again unsuccessfully.
Hi,
Thanks for this great package - I am using it in integration with Shiny and it does some real nice mapping!
That brings me to my question/issue: I have a shinydashboard interface that allows the user to define some inputs and hit an actionButton, which then calls a layer in GeoServer and returns WMSTiles, which I add to leaflet using addWMSTiles(). However, it appears leaflet caches a particular set of WMSTiles once they've been displayed. For example, if I change the colour in GeoServer and then add the same WMSTiles as previously, the legend changes, but the actual WMSTiles in leaflet remain unchanged, only when I change the zoom level does it render the WMSTiles with the new colour scheme. It then caches this map for that zoom level and so once a map has been rendered for a specific zoom level, it always returns the cached version, as opposed to what I am actually calling.
This happens despite the fact that I am executing clearTiles() and clearImages() before every new addWMSTiles() call. It only happens when I do this in a browser (Chrome or IE), but not if I run it within the RStudio window. I am tempted to believe it has something to do with this: http://stackoverflow.com/questions/15048096/how-do-i-force-a-leaflet-map-to-reload-all-tiles-including-visible-ones
My JS is not good enough to implement that and I was wondering if something like this could be part of the leaflet R package.
Thanks
Bastian
Here's the relevant code snippet (sorry, I don't think I can make it reproducible w/o a WMS Server, e.g. GeoServer installed):
leafletProxy("map") %>% clearTiles() %>% clearImages() %>% setView(lng = view_def$lng, lat = view_def$lat, zoom = view_def$zoom) %>% addProviderTiles(paste0(input$basemap)) %>% addWMSTiles( paste0('http://localhost:8080/geoserver/Hail/wms?service=WMS&version=1.1.0&request=GetMap&format=image%2Fpng'), layers = "Hail1", options = WMSTileOptions(format = "image/png", opacity = 0.5,transparent = TRUE), # attribution = "")