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

938
4
Jump to solution
04-27-2021 06:08 AM
SelectivelySocial
New Contributor III

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)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed 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

View solution in original post

4 Replies
jcarlson
MVP Esteemed 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
SelectivelySocial
New Contributor III

@jcarlson Thanks !!

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

 

0 Kudos
DavidPike
MVP Frequent Contributor

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

SelectivelySocial
New Contributor III

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

Thanks. 

0 Kudos