TransWikia.com

Refresh a georeferenced image after modifying its worldfile

Geographic Information Systems Asked by mdc on December 13, 2020

I have several raster layers which each layer is created from an image and its worldfile for georefencing.
I want to refresh the layers after changing the world files.
I have tried the code below but it does not refresh the image layer.
The image layers stay unchanged.
I am using QGIS 3.2.3. The code below is developed for a plugin.

# get the active layer
selected_layer = self.iface.mapCanvas().layers()
for layer in selected_layer:
    layer.setCacheImage(None)
    layer.dataProvider().reloadData()
    layer.triggerRepaint()

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP