8

I have a shapefile that contain bus lines. You can see a screenshot below:

enter image description here

I would like to visualize the lines in a more understandable way since there are a lot of overlapping sections.

I have tried to experiment with the offset of the lines.

enter image description here

However, this is a bit tricky since new overlapping sections are created.

Do you have a better recommendation? My goal is just to present them in a more understandable and clear way.

Taras
  • 32,823
  • 4
  • 66
  • 137
Anas.S
  • 223
  • 1
  • 4

1 Answers1

6

You can use the "Geometry Generator" to create additional lines where several lines overlap. I have 3 lines in 3 colors with an attribute no with values 1, 2 and 3. The lines are exploded.

I start with the red line (no 1) and create an additional symbol layer for each line that shares the same segments. Create an expression that only returns those segments from lines 2 and 3 that overlap, then apply an offset to that line and style it accordingly (color).

I used this expression to get the segments of line 2 that overlap line 1:

if (
    no=1,
    overlay_equals(
        @layer, 
        $geometry, 
        filter:=no=2
    )[0],
    ''
)

enter image description here

Taras
  • 32,823
  • 4
  • 66
  • 137
Babel
  • 71,072
  • 14
  • 78
  • 208