1

I am attempting to calculate the length (or percentage) of a line layer that overlaps a series of polygons.

As an example; lets say I was trying to calculate the distance I drove across a series of states during a road trip. The trace of my road trip is my line data and the states are my series of connected polygon data.

Ideally, I would use the overlap analysis feature but that seems to only work with two polygon features.

Is there another way to go about this? Is it possible to turn my line features into very think (e.g. 1 meter wide) polygons? This would allow me to use the overlap analysis feature.

1
  • Look at the Overlay tools, such as the Intersect or SAGA Identity. Note, after you run the overlay you must recalculate your geometry fields such as lengths. You may also want to do some sort of pivot table type analysis, either by exporting the data for use in a spreadsheet or by using the Group Stats plugin.
    – John
    Commented Feb 14 at 23:20

1 Answer 1

1

In field calculator you can try to use the follwing expression:

length(intersection($geometry, aggregate(layer:='Polygon', aggregate:='collect', expression:=$geometry)))

You could in addition use a fliter in aggreagte to get the length in only some states filter:="region_name" = 'name'.

enter image description here

You could also use buffer from geprocessing tools to generate a thin polygon from the line layer.

2
  • This worked. I used this expression on the Polygon layer. Within the expression, I used the road trip line data layer name as the 'Polygon'. Thank you very much for the help!
    – Pclark94
    Commented Feb 29 at 17:04
  • If your problem is solved you can mark it as solved. So that the topic is closed.
    – Xeppit
    Commented Feb 29 at 18:27

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.