0

I have a simple vector layer with LineString geometry. I want to styling this with dash line. How can I implement this with PyQGIS? I need to implement Stroke style property and red color as styling.

enter image description here

1
  • 1
    How about saving the style in qml format (xml) and applying it to a layer? Sep 28, 2022 at 10:52

1 Answer 1

1
symbol = QgsLineSymbol.createSimple({'line_style':'dash','color':symbolColor, 'width':'1.5'})
layer.renderer().setSymbol(symbol)
layer.triggerRepaint()
1
  • It working fine.
    – Raj
    Sep 28, 2022 at 11:54

Your Answer

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

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