Skip to main content
deleted 115 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I'm three years late, but hopefully whoever else might be stuck on an issue like this will benefit from my answer.

 # adds a LineLayerStyle (Arrow, dotted)  
 # layer being a vector layer object of QgsVectorLayer()
   def setLineLayerStyle(self, layer, style):  
     if(style == "arrow"):  
         sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("LineDecoration").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
         symbollist = layer.rendererV2().symbols()  
         symbol = symbollist[0]  
         symbol.appendSymbolLayer(sl) 

Following this code, you will get a line that looks like the pink arrow.

Following this code, you will get a line that looks like the pink arrow. All of this information is from here

I'm three years late, but hopefully whoever else might be stuck on an issue like this will benefit from my answer.

 # adds a LineLayerStyle (Arrow, dotted)  
 # layer being a vector layer object of QgsVectorLayer()
   def setLineLayerStyle(self, layer, style):  
     if(style == "arrow"):  
         sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("LineDecoration").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
         symbollist = layer.rendererV2().symbols()  
         symbol = symbollist[0]  
         symbol.appendSymbolLayer(sl) 

Following this code, you will get a line that looks like the pink arrow.

Following this code, you will get a line that looks like the pink arrow. All of this information is from here

 # adds a LineLayerStyle (Arrow, dotted)  
 # layer being a vector layer object of QgsVectorLayer()
   def setLineLayerStyle(self, layer, style):  
     if(style == "arrow"):  
         sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("LineDecoration").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
         symbollist = layer.rendererV2().symbols()  
         symbol = symbollist[0]  
         symbol.appendSymbolLayer(sl) 

Following this code, you will get a line that looks like the pink arrow.

Following this code, you will get a line that looks like the pink arrow. All of this information is from here

Source Link

I'm three years late, but hopefully whoever else might be stuck on an issue like this will benefit from my answer.

 # adds a LineLayerStyle (Arrow, dotted)  
 # layer being a vector layer object of QgsVectorLayer()
   def setLineLayerStyle(self, layer, style):  
     if(style == "arrow"):  
         sl = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("LineDecoration").createSymbolLayer({ 'width' : '0.26', 'color' : '0,0,0' })  
         symbollist = layer.rendererV2().symbols()  
         symbol = symbollist[0]  
         symbol.appendSymbolLayer(sl) 

Following this code, you will get a line that looks like the pink arrow.

Following this code, you will get a line that looks like the pink arrow. All of this information is from here