[QGIS-Developer] Rendering (simple) labels before background raster layer finishes?

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Thu Sep 9 01:06:46 PDT 2021


Hey list,

I have a fast vector layer in the foreground and a slow raster tile 
layer in the background. The vector layer has some simple labels. 
Neither layer uses any blending modes to my knowledge.

For rendering the labels QGIS waits until the layers have finished 
rendering which takes a while.
Our users can use the labels to orient themselves and to decide where to 
pan and zoom.
They could work faster if the labels would appear early on, before the 
slow raster layer finished rendering.

So I would like to have the labels render earlier, before the raster 
layer finishes loading, and then "just" composite(?) the scene for the 
final canvas image when done. Is there a reasonable way in PyQGIS to 
achieve that?

When I manually disable the raster layer, move the map, let it finish 
rendering (so the vector data and labels are visible) and then re-enable 
the raster layer, it plops up in the background without the labels being 
visibly re-rendered themselves so it seems technically possible.

As a hacky approach I tried disabling the raster layer right when the 
https://qgis.org/pyqgis/master/gui/QgsMapCanvas.html#qgis.gui.QgsMapCanvas.renderStarting 
signal, then re-enabling it when the render is done but of course that 
introduces "white flashes" from the background vanishing, then 
reappearing. Maybe it would be possible to tell QGIS to not request any 
new data/render for the raster layer for a while but use the cached 
render it currently has until the labels are done, then fetch and render 
for the updated extents?

Cheers, Hannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xBF7B268A77C202D5.asc
Type: application/pgp-keys
Size: 2471 bytes
Desc: OpenPGP public key
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210909/8b5f13b8/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210909/8b5f13b8/attachment.sig>


More information about the QGIS-Developer mailing list