8

Layers like municipalities, countries, ... have features sharing the border of their neighbours: they share the same vertices (except for the features at the edges off course).

I have a municipality layer, which I set with a dashed stroke style. However, for adjacent features, the borders are displayed as a solid line (see picture) enter image description here

How can I display all borders with a dashed stroke style?

Now it seems to overlap.

7

The "solid" border is actually two dashed lines. The dash patterns aren't aligned, so the dashes of each line cover the spaces of the other, creating the appearance of a solid line.

enter image description here

You can prevent the two borders from overlapping by choosing the option "Draw line only inside polygon."

enter image description here

This is the simplest method, but it has two downsides:

  • The dash patterns of shared borders are still mis-aligned.
  • The line width is cut in half around the outsides of the area, while the interior borders still appear full width.

To truly fix the issue, convert your polygons to lines.

  1. Run Polygons to lines algorithm to convert polygons to lines
  2. Run Dissolve algorithm to remove overlapping line segments.

    Note: this algorithm creates a temporary layer by default, which will be deleted when you close the project. Be sure to save the temporary layer by right clicking on the layer name and choosing the option "make permanent."

  3. Apply the same style to the dissolved lines layer as you used for the polygon borders.

enter image description here

  1. (Optional) If you want filled polygons, set the border stroke style to "No pen" for the polygon layer. Put the line layer above the polygon layer.
1

This is not an ideal solution (and I hope someone answers with a better one) but as an interim work-around you could try to following:

  • Convert the polygons to lines (Polygons to Lines)
  • Explode the lines features into segments (Explode Lines)
  • Delete duplicate lines (advice on that here), these are the ones where polygons share boundaries
  • Symbolise the resulting individual lines as dashed and use the original polygons as the fill

Not great I know but hope it helps.

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.