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:

Enabling the QGIS WMS cache - step 1

Enabling the QGIS WMS cache – step 1

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”:

Enabling the QGIS WMS cache - step 2

Enabling the QGIS WMS cache – step 2: create new “qgis_wms_cache” cache folder

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):

Enabling the QGIS WMS cache - step 3

Enabling the QGIS WMS cache – step 3: increase expiration period for tiles and cache size

Now we press “OK” and close the dialog. Time to try out a WMS service, zoom back and forth… and:
Enjoy!

3 thoughts on “Gaining more WMS speed through enabling the QGIS cache directory

  1. Thomas

    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.

    Reply
    1. neteler Post author

      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…

      Reply
  2. Pingback: Habilitando cache no QGIS para camadas WMS – Blog do Fernando Quadro

Leave a Reply

Your email address will not be published. Required fields are marked *