I have two layers : a line layer (red) and a polygon layer (green).

enter image description here

I would like to select the lines which 60% are contained in the polygon.

How can I do that?

Until now, I used "select by location" with the "have their centroid in" method, but in some cases, this method is no longer appropriated.

2 Answers 2


Here is a simple approach:

Add a field to your attributes that stores the length of the lines. Then clip the lines with the polygons. Finally select the lines whose new length is greater than or equal to the original length * 0.6. This gives you a set of Line IDs to select from in your original (un-clipped) layer.

You can do this as a multistage process, perhaps in Model builder and discard the intermediary data, or possibly as a nested SQL query if your data are in a suitable database.

  • Thanks a lot ! I just tested and it works well. I will make a python tool with in input the two layers, the ID field of the lines, the percentage.
    – superrache
    Feb 26, 2014 at 11:10
  • I like this approach. If you happen to use R, then the pracma and sp packages have tools to determine what's inside (or not) a polygon and related tricks. Feb 26, 2014 at 17:53

there's a number of steps needed to achieve this:

1 - Make a copy of the line dataset

2 - Create 2 fields in your line dataset and do a "calculate geometry" to calculate the length of each line in one of these fields, and add a unique name or number to each line in the other field.

3 - cut each line where it intersects a polygon.

4 - Add another field to the line dataset and calculate the new length.

5 - Now you have the old length and the new length, so you will be able to calculate which lines have 60% inside the polygons. Select them.

6 - Export these selected lines (which will be segments of the original lines). You can now do a spatial selection on your copy of the line dataset (the copy you made in step 1) to select the full lines.

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.