Hi all

I have a working python code snippet that enables updating a WMS layer with
a different named style.

It basically manipulates the raster provider's `dataSourceUri` property,
replacing the `style=` with a different substring. and then it calls for a
reload of the data and triggers a repaint of the layer. Something like this:

```
provider = layer.dataProvider()
original_uri = provider.dataSourceUri()
new_uri = modify_uri(original_uri)
provider.setDataSourceUri(new_uri)
provider.reloadData()
provider.dataChanged.emit()
```

It is working fine and the layer is shown with the updated style. Now I'd
like to have also the layer's legend be refreshed with the correct style.

Is this possible?

I've tried

```
iface.layerTreeView().refreshLayerSymboogy(layer.id())
```

This does not work, I am monitoring the WMS server's logs and I don't see
any new `GetLegendGraphic` request being issued.

Thanks in advance

-- 
___________________________ ___ __
Ricardo Garcia Silva
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to