Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a symbolLayer with a line-decoration (line-arrow) to a vectorlayer of linestrings. what i am trying at the moment is to create a new layer and set it's QgsLineSymbol with a list of symbollayers.

# Symbology
        simple_props = { 'width' : '1', 'color' : '255,255,255' }
        deco_props = { 'width' : '0.26', 'color' : '0,0,255' }

        simple = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("SimpleLine").createSymbolLayer(simple_props)
        deco = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("LineDecoration").createSymbolLayer(deco_props)
        s = QgsLineSymbolV2([simple, deco])

        self.ll.setRendererV2( QgsSingleSymbolRendererV2( s ) ) 

Every time QGIS trys to set the QgsLineSymbolV2 it crashes with a win32-exception. what am i doing wrong, or is there a possibilty to just add a new symbollayer to a existing vectorlayer?

share|improve this question
up vote 2 down vote accepted

So i don't know what was wrong, but i found a workaround. now i just add a second symbollayer to the existing symbol in the layer-renderer.

    sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("LineDecoration").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })
    symbollist = layer.rendererV2().symbols()
    symbol = symbollist[0]
share|improve this answer

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.