I am using QGIS and trying to find a way to calculate partial distances of lines in a grid.

In the left part of the picture you can see the sum of the line lengths within the grid cell (108.96...), and the length of the whole yellow line/segment that intersect it in black (146.37...).

How do I trim the yellow line to multi-lines which will show the proportional length in each cell (i.e 108.96+...+Len(Xn) =146.37)?


1 Answer 1


I figured it out myself - It is 2 steps process: 1. intersect the lines with the grid layer so all lines are split into segments. 2. Using field calculator: $length of the line layer

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.