[Qgis-user] Delete a class from QgsPalettedRasterRenderer

Alessandro Pasotti apasotti at gmail.com
Tue Nov 24 01:58:48 PST 2020


On Tue, Nov 24, 2020 at 8:17 AM PIERRE Sylvain <sylvain.pierre at bas-rhin.fr>
wrote:

> Hi List,
>
> I want to remove some class from a QgsPalettedRasterRenderer in a python
> script.
>
> I got the renderer and classes with :
>
> renderer = myLayer.renderer()
>
> clas = renderer.classes()
>
> I can iterate classes, modify label and so on.
>
> But I don’t find any tips to delete a class as I can do in the ui.
>
>
>
> Any idea?
>


There is apparently no API for that, you could try to use

QgsPalettedRasterRenderer::classDataToString

modify the string and then call:
QgsPalettedRasterRenderer::classDataFromString



Kind regards.

-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20201124/627d6c15/attachment.html>


More information about the Qgis-user mailing list