0

Is there a way to export the style of a layer thanks to pyqgis in a sld file?
I didn't find it in the documentation. I am in a 3.x version of Qgis

1 Answers1

0

You can use QgsMapLayer::saveSldStyle to export layer style as SLD.

layer = iface.addVectorLayer('C:/example.shp', 'mylayer', 'ogr')
layer.saveSldStyle('C:/Styles/SLD/layer_style.sld')
CodeBard
  • 256
  • 2
  • 4