[Qgis-community-team] [Get Feature Color] - How to?

Danilo da Silveira Figueira danilomalzao at hotmail.com
Thu Sep 10 10:14:16 PDT 2015


Hello All,

I'm stuck here, any help would be appreciated.
I have to create a attribute column with the respective color used in
renderer of this attribute, i am using the QgsVectorLayer
<http://qgis.org/api/classQgsVectorLayer.html>.loadSldStyle that creates a
QgsRuleBasedRendererV2
<http://qgis.org/api/classQgsRuleBasedRendererV2.html> but
the symbolsForFeature is returning empty.
With the symbol i could get the color and finish my job, but the
symbolsList is always empty.

My Try:

layer = QgsVectorLayer("estados.shp", "estados", "ogr")
if not layer:
  print "Layer failed to load!"

layer.loadSldStyle("estados_Nome.sld")
layer.triggerRepaint()
for curFeature in layer.dataProvider().getFeatures():
  layer.rendererV2().symbolsForFeature(curFeature)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-community-team/attachments/20150910/0304316a/attachment.html>


More information about the Qgis-community-team mailing list