0

In QGIS 3.14.16, I want to outline multiple polygons which share same attribute value.

Styling the layer with the same attribute value bring the following result: enter image description here

The style I wish to have is: enter image description here

I could use the dissolve function to get the expected result. However, this is not a solution for me, as I need to modify frequently the attribute table.

Is there a way to configure such a style?

My final goal is to style polygons layer with:

  1. Outlined polygons in function of a field (as described above),
  2. Colored polygons in function of another field.

Graphically speaking, I want to jump from that style: enter image description here

to this: enter image description here Polygons are colored with category according to field A. They are also outlined with category style according to field B.

EDIT

Here are examples of what I tried so far:

Example 1: enter image description here

Example 2: enter image description here

Example 3: enter image description here

Example 4 (this last example is the best way I found to circumvent that issue, see comments below): enter image description here

Xavier Michael
  • 392
  • 2
  • 11
  • 2
    Can you say something more about the attributes you're trying to combine? Because from a cartographical point of view your intended style is rather ... unwise. – Erik Oct 15 '20 at 10:11
  • Colored polygons represent surfaces in which rainwater flows in pipes. One pipe for one colored polygon. Additionaly, a pipe is either a rainwater pipe or mixed-water pipe (respectively blue and violet). I need to display these both informations simultaneously. – Xavier Michael Oct 15 '20 at 10:19
  • 2
    Then I suggest you stick with the colour-per-pipe solution, though maybe with more muted colours. The distinction between rainwater and mixed-water could be done by overlaying different hashes, e.g. one is vertical, the other horizontal or even crossed. And omit the borders of the polygons altogether. – Erik Oct 15 '20 at 10:42
  • 1
    Does this answer your question? Displaying categorised data using QGIS – JGH Oct 15 '20 at 11:27
  • I just tried the solution suggested by @JGH. Because of the amount of data to process, the project is not editable anymore. This was a nice try though! – Xavier Michael Oct 15 '20 at 12:45
  • @Erik Thing is, it is hard to get a rendered style good enough that way. I tried different kind of styles, without success. – Xavier Michael Oct 15 '20 at 12:48
  • 1
    @XavierMichael can you provide examples of what you tried and what they lack in your opinion? – Erik Oct 15 '20 at 13:15
  • As I understand, you want to apply a style based on a field to the fill color of a polygon and another one based on another field to the ouline color of the same polygon? – zakaria mouqcit Oct 15 '20 at 13:45
  • To circumvent that issue, I colored the surfaces in violet and blue (which respectively correspond to mixed- and rain-water surfaces), and applied the solution suggested by @JGH to outline the polygons per pipe. – Xavier Michael Oct 16 '20 at 09:16
  • @zakariamouqcit I want to apply a style based on a field to the fill color of a polygon and another one based on another field to outline the entire polygons which share same attributes (mixed- or rain-water surfaces). – Xavier Michael Oct 16 '20 at 09:23

1 Answers1

0

I would suggest using a Virtual Layer in conjunction with st_union().

Given a layer of polygons s with attribute r, click New Virtual Layer. On the dialog that appears, click Import to bring in the layer s.

Under Query, enter the following query:

  SELECT r,
         st_union(geometry)
    FROM s
GROUP BY r

The result will appear as a separate layer in the table of contents, but being linked to the same data source, will update as edits are made to the polygons layer. This new virtual layer can be styled separately, such as with a categorized simple outline.

In the image below, a series of squares are symbolized by one attribute, and a virtual layer as described above is overlayed.

grid with virtual layer

When the r attribute is edited for a selection of features, the virtual layer updates as well.

grid with virtual layer, with edits

jcarlson
  • 3,880
  • 1
  • 13
  • 34
  • A comment from above also suggested to use a virtual layer to get the expected display. Indeed, from my point of view, this is the right thing to do. However, this is definitely hard to try those solutions on my computer, as it runs too slowly to properly work on the project. The best solution I found so far is to use the expression suggested above, which consists in coloring the surfaces in violet and blue (which respectively correspond to mixed- and rain-water surfaces), and applied the solution suggested by @JGH to outline the polygons per pipe. Thank you all. – Xavier Michael Oct 20 '20 at 07:06