# How to check if a polyline is partially inside an extent ?

358
4
Jump to solution
04-27-2021 06:08 AM
New Contributor II

Is there a way to check if a polyline/line is partially inside an extent ?

I tried extent.contains,  but it only returns true if the whole line is inside the extent,even if little part of it lies outside the extent then it return false. Is there a way to solve this ?

Thanks.

Tags (2)
1 Solution

Accepted Solutions
by
MVP Frequent Contributor

You want intersects, which will return true if any part of the line is within the extent.

Edit: if you want to check for being partially within only, you could check that intersects returns true and contains returns false.

- Josh Carlson
Kendall County GIS
4 Replies
by
MVP Frequent Contributor

You want intersects, which will return true if any part of the line is within the extent.

Edit: if you want to check for being partially within only, you could check that intersects returns true and contains returns false.

- Josh Carlson
Kendall County GIS
New Contributor II

@jcarlson Thanks !!

I completely missed this method in documentation, feel really stupid.

MVP Frequent Contributor

I'd probably look at if extent.disjoint True/False which may be faster than an intersection (just a guess though).

New Contributor II

Though the data is not much, I'll still look into this.

Thanks.