,

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!

4 replies
  1. Thomas says:

    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

Trackbacks & Pingbacks

  1. […] simply setting up the QGIS cache (see this guide if you don’t know how) won’t cause caching of plain WMS responses (no matter what that guide says!), whereas WMTS […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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