I have a large layer of lines (telecommunication duct) with in parts several parallel lines that are close to each other (cause they lay in the same trench). I would like to count the length of the trench. But so far I only managed to count the sum of lines in QGIS 3.2

The number of parallel lines varies. So in some parts, there is only one line, in others 2 up to 8 parallel lines (duct in one trench).

My following example is a section with 4 parallel lines.

Example (simplified): 500 meter trench but over 200 meter lay 4 parallel duct (lines) - so I get 200 meter * 4 = 800 + 300 meter = 1.100 meter instead of 500

enter image description here

enter image description here

What have I tried so far

Buffer the lines and then: Vector -> Join attributes by location

Result: I got a Polygon but instead of counting 4 intersections it showed 7 or 8 -> I assume that cause the buffered lines overlap each other

Snap the geometries in a layer

Result: I chose a small tolerance and the 4 lines are perfectly aligned (they overlap perfectly). But when I sum up the length (with GroupStats) the length is 4 times the length (it counts every line)

I also tried to join the overlapping lines with Merge lines

Result: Error, it seems that qgis doesn't want to merge snapped lines

  • Try joining the overlapping lines using Dissolve instead of Merge lines. – csk Aug 26 '18 at 22:20
  • I think this solves my problem. Dissolve worked perfect. 1. Snap the parallel lines so they overlap 2. Dissolve overlapping lines Thanks a lot! :) – Phil Aug 27 '18 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.