[Qgis-developer] Batch generation of map images with MTR

Richard Burkmar rich.burkmar at gmail.com
Wed Nov 5 03:12:58 PST 2014


I have code for a python plugin (https://plugins.qgis.org/plugins/TomBio/)
that follows this pattern:

* display vector layer A in map canvas
* use the canvas saveAsImage method to save map image
* hide vector layer A from map canvas
* display vector layer B in map canvas
* use the canvas saveAsImage method to save map image
* hide vector layer B from map canvas

This works very well in QGIS 2.0.1 - it can rapidly generate hundreds of
map images. But I updated to 2.6 and it no longer works. All the map images
are created without the vector layers being visible. It seems like the
layers are only actually rendered at the end of the process. I tried using
the canvas refresh method in the loop, but it made no difference.

I also compared the behaviour of the MMQGIS plugin's animation tools, which
work in a similar way, and they have the same problem - i.e. they don't
work with QGIS 2.6.

I just joined the developer list and looking back over some previous posts
and doing some background reading here -
http://www.lutraconsulting.co.uk/products/qgis-mtr/ - it seems as though
the introduction of multi-threaded rendering (MTR) may be responsible.

Is there any way I can work with the new rendering system to get this
pattern working in recent versions of QGIS?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141105/666bad1d/attachment.html>


More information about the Qgis-developer mailing list