I want to change the style of the polygon contained in the vector layer. Is there any API available?

(I can click the properties of the shapefile, then select the style and change the symbol properties, but I want to do this programmatically.)

I am using Python to customise QGIS.


1 Answer 1


The documentation can be found here: http://www.qgis.org/pyqgis-cookbook/vector.html#appearance-symbology-of-vector-layers

I haven't tried it yet, so I cannot provide any further pointers but the code examples there look good to go.

  • when we try to access class 'QgsMarkerSymbolLayerV2' from the python console inside the QGIS , It showed me that 'class doesn't exist' I am using QGIS 1.7
    – Vicky
    Nov 5, 2011 at 10:26
  • Works for me (running 1.7.1): >>> QgsMarkerSymbolLayerV2 <class 'qgis.core.QgsMarkerSymbolLayerV2'>
    – underdark
    Nov 5, 2011 at 11:29

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