Skip to main content
deleted 47 characters in body; added 3 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Almost 5 years since the original post now, but whenWhen I tried the to use code based on the answer by GreyEyedPallas@GreyEyedPallas (in QGIS 2.18), I got a message:

AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'

AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'

To fix this, I needed to use ArrowLine instead of LineDecoration as follows:

sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("ArrowLine").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
symbollist = layer.rendererV2().symbols()  
symbol = symbollist[0]  
symbol.appendSymbolLayer(sl)

Almost 5 years since the original post now, but when I tried the to use code based on the answer by GreyEyedPallas (in QGIS 2.18), I got a message:

AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'

To fix this, I needed to use ArrowLine instead of LineDecoration as follows:

sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("ArrowLine").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
symbollist = layer.rendererV2().symbols()  
symbol = symbollist[0]  
symbol.appendSymbolLayer(sl)

When I tried the to use code based on the answer by @GreyEyedPallas (in QGIS 2.18), I got a message:

AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'

To fix this, I needed to use ArrowLine instead of LineDecoration as follows:

sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("ArrowLine").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
symbollist = layer.rendererV2().symbols()  
symbol = symbollist[0]  
symbol.appendSymbolLayer(sl)
Source Link
Jonny
  • 469
  • 3
  • 15

Almost 5 years since the original post now, but when I tried the to use code based on the answer by GreyEyedPallas (in QGIS 2.18), I got a message:

AttributeError: 'NoneType' object has no attribute 'createSymbolLayer'

To fix this, I needed to use ArrowLine instead of LineDecoration as follows:

sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("ArrowLine").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
symbollist = layer.rendererV2().symbols()  
symbol = symbollist[0]  
symbol.appendSymbolLayer(sl)