[Qgis-developer] How to change the renderer image symbol

Martin Dobias wonder.sk at gmail.com
Mon May 17 17:54:58 EDT 2010


On Fri, May 14, 2010 at 5:40 PM, Marcelo Reyes <reyesmarcelo at gmail.com> wrote:
> Hello,
>
> I'm using Pyqgis.
>
> I'm trying to change the image for a vector layer. The default image is a
> circle, I wish to change that for a triangle for some of the features, and
> keep the circle for some other. I'm using a UniqueValueRender. The layer has
> 8 types of features, the first 3 should be rendered as triangles in the map,
> and the remaining 5 as circle. So far I've creted the QgsSymbols, but I dont
> see how to modifie the renderer to achieve this. Any help is welcome.

Hi,

you can use either "old" symbology or "new" symbology (from 1.4). I
would recommend the latter as it is better extensible, though you may
choose the original symbology for compatibility with older versions.

An introduction to the new symbology approach can be found here:
http://www.qgis.org/wiki/Symbology-NG

For old symbology unfortunately there is no such guide (yet). But you
were on the right track: first you need to construct QgsSymbol
instances, then add them to a renderer class using addSymbol method,
finally apply the renderer to your vector layer (setRenderer).

Regards
Martin


More information about the Qgis-developer mailing list