<div dir="ltr">Hi QGIS-Server-Devs<div><br></div><div>its about QGIS-Server 3.22</div><div><br></div><div>I have a project served by QGIS-Server containing 70-80 raster and vector layers from http sources. These sources are dynamic and not under my control. Lets say <a href="http://dummy.com/geo.tif">http://dummy.com/geo.tif</a> or <a href="http://dummy.com/geo.json">http://dummy.com/geo.json</a>. The content of these tif/json changes over time. So I need QGIS-Server to reload it on every request I send to the WMS. I came up with the idea of a plugin. The idea of acting based on passed layers url param and on dedicated layers comes from the really bad loading speed of this project. So reinitializing the project on request is no solution.</div><div>My current plugin does work fine for vector layers. On every request I call</div><div><br></div><div>layer.dataProvider().reloadData()<br></div><div><br></div><div>and the vector data is freshly fetched from the server as expected.</div><div><br></div><div>However this is not working for raster layers. It is my understanding that GDAL is used as dataProvider. It has no effect if i call reload on the QgsRasterLayer or reloadData on the QgsRasterDataProvider. It simply does not have any effect.</div><div><br></div><div>I already invested quite a time and found these places of info:</div><div><a href="https://gis.stackexchange.com/questions/294675/changing-uri-source-of-wms-raster-layer-in-place-pyqgis">https://gis.stackexchange.com/questions/294675/changing-uri-source-of-wms-raster-layer-in-place-pyqgis</a><br></div><div><br></div><div><a href="https://gis.stackexchange.com/questions/159950/making-qgis-layer-update-from-changed-data-source">https://gis.stackexchange.com/questions/159950/making-qgis-layer-update-from-changed-data-source</a><br></div><div><br></div><div>I stumbled over this QGIS-Desktop-Plugin wich works nice and does what I want. It resuts in a valid updated raster layer without changing the QgsRasterLayer Object layer: <a href="https://github.com/enricofer/changeDataSource/blob/master/setdatasource.py#L175">https://github.com/enricofer/changeDataSource/blob/master/setdatasource.py#L175</a></div><div><br></div><div>Despite the fact that this way of manipulating the DOM seem not work on server because running my plugin for raster layers crashes QGIS-Server process and I do not get any info what might be wrong (it runs with loglevel 0). I would be happy to get some suggestions on what might be wrong here. You can find my current WIP state here: <a href="https://github.com/opengisch/qgis-layer-tweak/blob/master/tweak_server.py">https://github.com/opengisch/qgis-layer-tweak/blob/master/tweak_server.py</a></div><div><br></div><div>Sorry for the long description.</div><div><br></div><div>I hope you can give me directions.</div><div><br></div><div>Cheers Clemens</div></div>
<br>
<div style="text-align:left"><a href="https://qfield.org/get/" target="_blank"><img src="https://www.opengis.ch/wp-content/uploads/2022/04/Qfield_Banner_email.png" alt="https://qfield.org/get/"></a><span style="font-family:Arial"><a><br></a></span></div><div style="text-align:left"><span style="font-family:Arial">QFIELD 2.0 IS HERE!<span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><font size="3"> </font></span>- Hold the power of QGIS in your hand</span><span style="font-family:Arial"> - <a href="https://www.opengis.ch/2022/04/05/qfield-2-0-is-here/" target="_blank">learn more</a> - <a href="https://qfield.org/get" target="_blank">get it now</a><br></span></div>