9

I have some polygons in a shp file that I need to change their line width. I head joined them in one group

enter image description here

Is there a way to change the line with for all of the layer in the group simultaneously and not one after the other?

14

With a little help from Python, we could set the border width for all layers in your "State" group to a specific value (e.g. 0.16 as shown in your image).

Try testing the following in the Python Console:

root = QgsProject.instance().layerTreeRoot()
state_group = root.findGroup("State")
border_width = 0.16

for layers in state_group.children():
    layer = layers.layer()
    symbols = layer.rendererV2().symbols()
    symbols[0].symbolLayer(0).setBorderWidth(border_width)
    layer.triggerRepaint()
    iface.legendInterface().refreshLayerSymbology(layer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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