3

I have a standalone application which uses the QGS api to view and query map layers. One layer is a WMS-C layer which automatically caches tiles which is great. I want to also activate a setting which is present in QGIS but I can't work out how to implement it in my app, namely:

  • Use render caching... (Settings -> Options -> Rendering)

I found the QSettings key for this in QGIS by browsing the output of:

from PyQt4.QtCore import QSettings
s = QSettings().allKeys()
for k in s:
    print k

The one I need to access/emulate/implement is:

Qgis/enable_render_caching

Where can I activate/implement these settings in my standalone app? Is this the setting that is read by QgsMapCanvas.setCachingEnabled(bool)?

2

Where can I activate/implement these settings in my standalone app? Is this the setting that is read by QgsMapCanvas.setCachingEnabled(bool)?

Yes, to the latter. That is what is called when the Options dialog is confirmed and closed.

Oddly, the caching setting is only read in on QgisApp::QgisApp initialization when QgisApp::createOverview() is called. In any event, the default is ON until otherwise set by the user.

Using QgsMapCanvas.setCachingEnabled(bool) should change caching the setting on-demand for you in your PyQGIS app.

To set the qgis/enable_render_caching (note the key may be case-sensitive on some platforms, i.e. it is 'qgis', not 'Qgis'), see how it is done in QgsOptions.

  • Thanks, I didn't even think to find it on GitHub - I should have checked, I would have found the answer! – James N Aug 7 '14 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.