Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to set the color of a vectorlayer feature depending on the feature attributes with PyQGIS. How do you acces the attributes of a vectorlayer feature?

share|improve this question
This recent answer may help you: gis.stackexchange.com/questions/31799 –  dakcarto Aug 20 '12 at 17:09
Thank you that was helpfull. –  Ulf Sep 26 '12 at 11:45

1 Answer 1

Right click on the layer in the table of contents > properties > style tab > there you have options to style as a single symbol, using categories, using graduated colours, and rules.

You then have the option to choose the field containing the values to be displayed.

See the QGIS manual for more information: http://docs.qgis.org/user_guide/html/en/


share|improve this answer
The OP is looking for a way to doing this using pyqgis which is the QGIS Python API, not via the GUI –  Nathan W Aug 20 '12 at 10:37
I realise that now after getting a mark down for my "answer" :-P –  mixedbredie Aug 20 '12 at 13:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.