Friday 30 September 2016

Getting currentfeature's color in Expression Builder of QGIS?


In QGIS Expression builder. I want to obtain the color code of the current feature.


I mean:


My layer contains lines, each one is painted with a different color. Now I want to assign that color to its label. In label definition, in the color property's expressions builder, how could I obtain that attribute?


I tried:


attribute( $currentfeature, 'color')


But it is not working...



Answer



In QGIS >= 2.14 you can use the symbol_color variable. Eg, set a data defined override for your label color to the expression @symbol_color


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...