<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Thanks for the answer!</div><div>Sorry but I didn't understand how to use QgsSimpleMarkerSymbolLayerV2.</div><div>I did some attempt but I didn't manage..</div><div>Below there's my code (with only two symbol item as example)</div><div><br></div><div><p style="margin: 0px; padding-left: 30px;">myTargetField = field<br> myRangeList = []<br> myOpacity = 1</p></div><div><br></div><div><p style="margin: 0px; padding-left: 30px;"> # symbol 1<br> mySymbol = QgsSymbolV2.defaultSymbol(layer.geometryType())<br> mySymbol.setColor(QColor('#FFFFFF'))<br> mySymbol.setAlpha(myOpacity)<br> myRange = QgsRendererRangeV2(0.1,34.4,mySymbol,"< 35")<br> myRangeList.append(myRange) <br> # symbol 2<br> mySymbol = QgsSymbolV2.defaultSymbol(layer.geometryType())<br> mySymbol.setColor(QColor('#238443'))<br> mySymbol.setAlpha(myOpacity)<br> myRange = QgsRendererRangeV2(34.5,39.4,mySymbol,"35 - 39 dB(A)")<br> myRangeList.append(myRange)</p><p style="margin: 0px; padding-left: 30px;"># other symbol items</p><p style="margin: 0px; padding-left: 30px;"><br></p><p style="margin: 0px; padding-left: 30px;">myRenderer = QgsGraduatedSymbolRendererV2('', myRangeList)<br> myRenderer.setMode(QgsGraduatedSymbolRendererV2.EqualInterval)<br> myRenderer.setClassAttribute(myTargetField)<br> <br> layer.setRendererV2(myRenderer)<br> iface.legendInterface().refreshLayerSymbology(layer)<br>layer.triggerRepaint()</p></div><div><br></div><div><br></div><div>And I want that symbol 1 became a square.</div><div>I can't <span style="font-size: 16.3636360168457px;" data-mce-style="font-size: 16.3636360168457px;">understand how to use </span><span style="font-size: 16.3636360168457px;" data-mce-style="font-size: 16.3636360168457px;">QgsSimpleMarkerSymbolLayerV2.</span></div><div><br></div><div>Sorry and thank you!</div><div><br></div><div>C</div><div>S<br><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>Da: </b>"Salvatore Larosa" <lrssvtml@gmail.com><br><b>A: </b>"Stefano Masera" <stefano.masera@arpa.piemonte.it><br><b>Cc: </b>"qgis-developer" <qgis-developer@lists.osgeo.org><br><b>Inviato: </b>Lunedì, 13 ottobre 2014 11:21:37<br><b>Oggetto: </b>Re: [Qgis-developer] how to set square symbol in a point layer with python<br><div><br></div>Hi,<br><div><br></div>On Mon, Oct 13, 2014 at 10:11 AM, Stefano Masera<br><stefano.masera@arpa.piemonte.it> wrote:<br>> Hi list,<br>> I wan't to set a square symbol in a point layer with python.<br>><br>> Currently, I use a graduated symbol legend, and I have a circle (point)<br>> symbol with this line for each item:<br>><br>> symbol = QgsSymbolV2.defaultSymbol(layer.geometryType())<br>><br>> But I want to set a square for one item.<br>><br>> How can I do?<br><div><br></div>after having got the symbol layer (QgsSimpleMarkerSymbolLayerV2) you<br>can use the setName() method to change from circle (default) to any<br>other symbol. In your case setName("square").<br><div><br></div>Regards,<br>-SL<br><div><br></div>-- <br>Salvatore Larosa<br>linkedIn: http://linkedin.com/in/larosasalvatore<br>twitter: @lrssvt<br>skype: s.larosa<br>IRC: lrssvt on freenode<br></div><div><br></div></div></body></html>