Hey, thank you. It worked.<br>However, some Qgis code changed (eg: createSimple doesn't exist anymore), so I had to adapt a little bit.<br><br><div class="gmail_quote">On Mon, Apr 11, 2011 at 1:46 PM, Marco Bernasocchi <span dir="ltr"><<a href="mailto:marco@bernawebdesign.ch">marco@bernawebdesign.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Chris,<br>
have you looked at [1]?<br>
here my sample code using rendererV2:<br>
<br>
layer = QgsVectorLayer("Point?crs=epsg:4326", "myLayer", "memory")<br>
symbol = QgsMarkerSymbolV2.createSimple( { 'color' : '0,255,128' } )<br>
layer.setRendererV2( QgsSingleSymbolRendererV2( symbol ) )<br>
<br>
ciao Marco<br>
[1]<br>
<a href="http://www.qgis.org/pyqgis-cookbook/vector.html#appearance-symbology-of-vector-layers" target="_blank">http://www.qgis.org/pyqgis-cookbook/vector.html#appearance-symbology-of-vector-layers</a><br>
<div><div></div><div class="h5"><br>
On 04/11/2011 12:58 PM, Goo Creations wrote:<br>
> Hi<br>
><br>
> I've got a vector file (shp) with a bunch of points in it. I want to<br>
> load the points to the canvas with a specific color (not the random<br>
> color QGIS provides). I've tried a couple of tutorials, but the code<br>
> provided doesn't change the color.<br>
><br>
> /mask = QgsVectorLayer(maskPath, "my_mask", "ogr")/<br>
> /sy = QgsSymbol( mask.geometryType() )/<br>
> /sy.setFillColor(Qt.red)/<br>
> / /<br>
> /renderer = QgsSingleSymbolRenderer( mask.geometryType() )/<br>
> /renderer.addSymbol( sy )/<br>
> /renderer.updateSymbolAttributes()/<br>
> / /<br>
> /mask.setRenderer( renderer )/<br>
> /mask.triggerRepaint()/<br>
> /self.iface.legendInterface().refreshLayerSymbology(mask)/<br>
><br>
> Did I forget anything, or should I do something diffrently?<br>
><br>
> Chris<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<font color="#888888"><br>
--<br>
Marco Bernasocchi<br>
<a href="http://www.bernawebdesign.ch" target="_blank">www.bernawebdesign.ch</a><br>
skype: mbernasocchi<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</font></blockquote></div><br>