I'm using a python script to manipulate the display of shapefiles in QGis.

My code basically selects an active layer and sets a field as the label of the point. Like this:

layer = qgis.utils.iface.activeLayer()
label = QgsPalLayerSettings()
label.enabled = True
label.fieldName = 'objnam'
label.placement= QgsPalLayerSettings.OverPoint

This give's me the following result:

Text label overlapping a default point marker

I would like to add code so that the coloured marker will not be visible. I've tried adding the following above my code in attempt to make the marker transparent:

renderer = layer.rendererV2()
symbol = QgsFillSymbolV2.createSimple({'style':'solid', 'color': '255,255,255,0', 'style_border':'no'})

But this seems to do nothing. I have a feeling that I misunderstand how the symbol layer works. Any help or guidance is welcomed.

1 Answer 1


Size should be 0. Just add this parameter to the params dictionary like below:

symbol = QgsFillSymbolV2.createSimple({'size':'0'})
  • This did not work.
    – FredFury
    Apr 14, 2016 at 9:38
  • So try only with {'size':'0'} it works for me.
    – dmh126
    Apr 14, 2016 at 9:44
  • Still no luck. I'm using 2.8.3-Wein on Ubuntu. Will investigate more.
    – FredFury
    Apr 14, 2016 at 9:47
  • okay, on it's own this works. I just need to find out why it's not working within the rest of my script. I keep getting a 'QgsRuleBasedRendererV2' object has no attribute 'setSymbol'
    – FredFury
    Apr 14, 2016 at 10:55
  • So the moment I try to remove the marker while doing rule based rendering I get an error.
    – FredFury
    Apr 18, 2016 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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