7

I have defined a layer symbology like shown in the screenshot below (categories are applicable laws however).

enter image description here

The layer symbology is defined like this i.e. (no pattern fill):

enter image description here

For these three categories it would be no big deal to change the outline color separately, but imagine some tens of categories this would be linear time consuming.

So is there a way to change some aspect of the symbology (like the outline color) at once without losing the settings for the fill style?

  • Do you want the same border color as the line fills? – ndawson Jun 8 '16 at 21:32
7

Select your symbols by either clicking them individually whilst holding Ctrl or click the uppermost symbol, hold Shift and click the last symbol you want selected. Then go to Symbol > Change:

Categorised style

Then select your fill and set the border style:

Symbol Properties

When you click OK, the selected symbols should be updated with the new border properties:

Style resuls


EDIT:

To keep your pattern fills, a possible workaround is after you have categorised your layer, change it to Rule-based. This will create expressions for each of your symbol which should match the categorised version. Then create a new rule which has a transparent fill and set your border with the required settings and with no filter/rule:

Border

You should now have features which contain your pattern fill but with the border you have set:

Result

  • Yes and no. The categories each keep their fill colors, but the fill style is made all the same. Check this out if you assign different fill styles (Solid, BDiagonal, Horizontal,...) to some few of your categories and do again what you have done. I tried this with 2.14.3 and 2.8.9 LTR. – Jochen Schwarze Jun 8 '16 at 10:00
  • @JochenSchwarze - Edited the post with a possible workaround. Don't think this is possible manually (yet) but could probably be done using Python. – Joseph Jun 8 '16 at 12:17
  • 1
    This is what I learned from gis.stackexchange.com/questions/195827/…, everything is possible with a bit of python ;-) – Jochen Schwarze Jun 8 '16 at 13:14
  • 1
    But besides, nice workaround. If I make it using bit of python I'll post it here. – Jochen Schwarze Jun 8 '16 at 13:22
  • @JochenSchwarze - Haha! Yes, glad you looked at a possible python solution ;) – Joseph Jun 9 '16 at 9:22
3

This is a bit of python that does the trick. That layer-renderer-symbol-symbollayer thing is a bit weird at first sight, but ok.

from PyQt4.QtGui import QColor

r = iface.activeLayer().rendererV2()
for s in r.symbols():
    s.symbolLayers()[0].setOutlineColor(QColor('#ffff00'))
iface.mapCanvas().refresh()

Just tested this on the console and it works for the first time, but trying it a second time leeds to

enter image description here

  • interesting! Your code works fine on Ubuntu, Qgis 2.14.3 (although the last line should be iface.mapCanvas().refresh() ..?). At least it does when written into a .py file (rather than being pasted direct into the console). – Steven Kay Jun 8 '16 at 18:59
  • Added parantheses, Test it with 2.14.3 on Windows later. – Jochen Schwarze Jun 9 '16 at 6:49

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.