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

10
  • 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
    Commented Oct 15, 2020 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. Commented Oct 15, 2020 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
    Commented Oct 15, 2020 at 10:42
  • 1
    Does this answer your question? Displaying categorised data using QGIS
    – JGH
    Commented Oct 15, 2020 at 11:27
  • 1
    @XavierMichael can you provide examples of what you tried and what they lack in your opinion?
    – Erik
    Commented Oct 15, 2020 at 13:15

1 Answer 1

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

1
  • 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. Commented Oct 20, 2020 at 7:06

Your Answer

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

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