3

I'm struggling with creating a visually clean dashed line style in QGIS for overlapping boundaries of two layers. Here's my setup:

Context: I have two polygon layers: Protected Area (green): Dashed boundary. Habitat Area (purple): Solid boundary.

These layers overlap partially. Where they share boundaries, the dashed line should align nicely with the solid line for a professional look.

Current Issues: When I apply a dashed line style to the "Protected Area" layer (green), the dashes are inconsistent. They often form irregular patterns, especially on curved or complex geometries. I tried the "Custom Dash Pattern" option with specific values for dash length and gap (e.g., 2 mm dash, 1 mm gap), but the results are uneven.(2 screenshots for context)

The dashed pattern scales awkwardly when exporting maps or zooming in/out, making the visualization look unprofessional.

I also enabled "Align dash pattern to line length," but it didn't improve the result.

Attempts: Used Geometry Simplification to smooth out the line geometry. It helped slightly but didn't solve the root issue.(Screenshot, it somehow smoothed out a couple squares with different tolerance attempts but taht's about it) Tested combinations of line styles, widths, and custom dash patterns, but the dashes still appear uneven or misaligned.

Goal: I need a clean and professional dashed line for the green boundary that:

Aligns properly with the shared boundary (solid purple line). Scales well for A0-sized maps at a 1:10,000 scale.

Question: How can I achieve a consistent and elegant dashed line for overlapping boundaries in QGIS? Is there a specific workflow, setting, or workaround I should follow? Maybe my starting point is compelety off?

starting point: I extracted the boundaries of both polygon layers using the "Extract Boundary" tool. I then used the "Intersection" tool to identify and isolate the shared boundaries between the two layers.

Additional Note: I do not want to use boundary offsets (e.g., shifting one line inward or outward) to solve this issue, as I aim to keep the boundaries geographically accurate.

Screenshot1: One of many Custom Dash Pattern Screenshot2: Dash Pattern Option

One of many Custom Dash Pattern

Dash Pattern

2
  • 1
    You might see if using different units (e.g. points, meters at scale, map units) instead of the default millimeters for various settings work better, especially for scaling. Also simple lines are simple; perhaps marker lines will give you a better look. Commented Jan 27 at 21:54
  • Maybe sharing a sample of your data could help for testing purpose. I can't reproduce the behaviour, so probably is something related to your data. See also here: gis.stackexchange.com/a/468834/88814 Commented Jan 28 at 9:56

1 Answer 1

3

Another thing you can try is Geometry Generator styling to create a static multiline symbol.

This expression create points interpolated along the boundary of the polygons every 40 m, it then buffers the points by 10 m, and difference the polygon boundary with the buffered points, to create gaps where there are buffered points. You'll have to adjust the distances to look good at your specific scale.

difference(boundary($geometry),
make_valid(
collect_geometries(
array_foreach(array:=
  generate_series(start:=0, stop:=$perimeter, step:=40)
  ,expression:= buffer(line_interpolate_point(geometry:=boundary($geometry), distance:=@element), 10)))))

enter image description here

There's also the function apply dash pattern you can try:

Applies a dash pattern to a geometry, returning a MultiLineString geometry which is the input geometry stroked along each line/ring with the specified pattern.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.