Line in Polygon

3520
7
09-17-2015 04:27 PM
IanIrmischer
New Contributor III

I have 200 polyline featureclasses.  Each feature class has about 2000 features.  I would like to add a new field to each line featureclass that states whether the majority or all of a line falls within a polygon.

Any ideas? I would like to automate this with python since I have so many features and feature classes.

Thanks,

Ian

0 Kudos
7 Replies
NeilAyres
MVP Alum

Well it will certainly be do-able but...

One Polygon or many? How do you want this to be reported ie adding a field to the lines stating how much lies within...

Is your data projected to a planar system?

0 Kudos
IanIrmischer
New Contributor III

Hi Neil, I there is a polygon shapefile. Lets call it a lakes. There are

many lakes. Currently it is a multipoly with just one feature but I could

break in up so each lake was its own feature. I basically want to know if

the line falls mostly in a lake or not.

For the line FC, I would like a new field coded with a 1 or 0. 1 if >50%

of the line falls within the lake. 0 if not. All the data is in UTM.

Does that make sense?

Ian

0 Kudos
NeilAyres
MVP Alum

Couldn't you do just an intersect or union function on the lines and the polys, then process the output to compute the result.

IanIrmischer
New Contributor III

I know my solution is somewhere around the overlay and spatial join tools.

I read that union was polygon to polygon so I don't think that will work

with my line.

As for intersection, the output is new features. And it cracks the lines

into new lines if only part of the line falls within the polygon. I just

want a Boolean response to whether the majority of a line segment falls

within the polygon.

Is there a way to choose the line if more than half of it falls within the

polygon? I am worried about a scenario where only part of the line falls

inside a lake.

Thanks,

Ian

0 Kudos
DanPatterson_Retired
MVP Emeritus

The ability to determine proportional inclusion or intersection would require creating new features... somewhere, permanent or temporary... so you may as well add length fields to the target feature, perform the intersect/whatever, then calculate a new geometry field and a proportion field (length new/length original) and query for those that are completely within (100%) or significantly within (>50% for example) and save those results to a final destination file.

IanIrmischer
New Contributor III

Dan, Thanks for the help.

Ian

0 Kudos
GabrielUpchurch1
Occasional Contributor III

To build on what Dan suggested, you can join the attribute table from the final results back to your original line data if you need the lines in their original form.