Gaining more WMS speed through enabling the QGIS cache directory
Interestingly the WMS caching is not enabled by default in QGIS. To better enjoy WMS/WMS-C/WMTS connections – if you have some disk space to dedicate – it is a good idea to enable the cache in these few steps:
Go to the menu entry Settings >> Options:
Go to tab “Network“. Therein, in “Cache settings“, select the “Directory” and choose a folder for the cache files. Be sure that there is free space for lots of megabytes can be stored there over time. And this directory should ideally be located on a fast disk (if you have several).
Here I choose the existing “tmp/” folder in my HOME directory and create inside a new folder “qgis_wms_cache”:
Eventually we change the “Default expiration period for WMS-C/WMTS tiles (hours)” to more than 24 hours (as it would be rather useless…). Here I change to 24*30 = 720 hours. And the cache size we increase as well, here to 250MB (written as 250000 since it is to be given in kilobytes):
Now we press “OK” and close the dialog. Time to try out a WMS service, zoom back and forth… and:
Enjoy!
I don’t think that ‘pure’ WMS-Layers are cached. I tested it with fiddler and recognised that only WMS-C / WMTS are cached but not normal WMS-layers. So your sentence “To better enjoy WMS/WMS-C/WMTS connections…” is a bit misleading. Only the capabilities-document is cached for normal WMS-layers.
Thanks for your comment. I didn’t check the source code but got a notable speed-up. Maybe a QGIS developer could shed some light on this…