[Qgis-developer] how to set square symbol in a point layer with python

Salvatore Larosa lrssvtml at gmail.com
Mon Oct 13 02:21:37 PDT 2014


Hi,

On Mon, Oct 13, 2014 at 10:11 AM, Stefano Masera
<stefano.masera at arpa.piemonte.it> wrote:
> Hi list,
> I wan't to set a square symbol in a point layer with python.
>
> Currently, I use a graduated symbol legend, and I have a circle (point)
> symbol with this line for each item:
>
> symbol = QgsSymbolV2.defaultSymbol(layer.geometryType())
>
> But I want to set a square for one item.
>
> How can I do?

after having got the symbol layer (QgsSimpleMarkerSymbolLayerV2) you
can use the setName() method to change from circle (default) to any
other symbol. In your case setName("square").

Regards,
-SL

-- 
Salvatore Larosa
linkedIn: http://linkedin.com/in/larosasalvatore
twitter: @lrssvt
skype: s.larosa
IRC: lrssvt on freenode


More information about the Qgis-developer mailing list