0

I am wondering if there is any way / python code to force QGIS 3.12 to reload the data source of mesh layer and its assigned datasets?

Mesh layer is a .xmdf file that's similar to .2dm with assigned datasets.

My layer:

from qgis.core import QgsProject
layer = QgsProject.instance().mapLayersByName('urib_v61-T_F100_P')[0]

I tried:

layer.dataProvider().forceReload()
AttributeError: 'QgsMeshDataProvider' object has no attribute 'forceReload'

layer.dataProvider().Reload()
AttributeError: 'QgsMeshDataProvider' object has no attribute 'Reload'

This seems to just force redraw of layer in Map Canvas:

layer.setAutoRefreshInterval(360000)
layer.triggerRepaint()

This works for raster layers but doesn't seem to refresh assigned datasets:

layer.dataProvider().reloadData()

1 Answer 1

2

Mesh and all datasets should be possible to reload with

layer.dataProvider().reloadData()

canvas and all widgets should automatically refresh too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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