Performing "mostly within" selection using ArcMap?
While I think you could do with refining your question with a bit more detail (how much of the line has to be within to qualify, how do you want to handle lines coincident with polygon edges, etc... I do have a thought on generally how you might be able to approach this problem. Yes, this would be a relatively elaboarate method to accomplish what should be pretty easy to do, but... it should work none-the less. One way would be to build a model or script that would use a GP tool to split all of your line segments at the polygon boundary (I would probably do this with clip tool using a layer with selection applied for the polygon to clip by so it only uses the polygon(s) in question. If you have the output of that tool go to a geodatabase and you have your initial dataset in a geodatabase, then you would just have to do a table to table join on the two line files (original and output of GP tool) and then calculate the percentage difference between the two Shape.Len fields (if a line segment in original file is 100 ft long, and that same line segment, clipped to the polygon, is 75ft long, then 75% of that line would be within the polygon). Then you could just do a select by attribute based on this percent.
Again, I know this is rather involved, it creates an intermediary dataset, and there probably is an easier way to do this that I don't know about; but, if you write a model or script to do such, and delete the output line FC when you're done with it, it shouldn't appear all that difficult to the end user... even if it's a bit of a pain to build initially.
Just some thoughts, and let me know if that doesn't make sense and I'll try and explain better.
Based on the responses I received here, I used a combination of ideas provided.
First what I did was add a Length and Percent field to my original dataset. I copied the Shape.Length values into the Length field.
Secondly, instead of using Clip, which is significantly more work in this case, I used the Intersect tool. This "clips" the polylines that intersect the polygons and adds in some potentially valuable attributes. Despite having a truly unique ID field, I don't think its really required when using a static length field.
Finally, I just simply calculate the percent of the difference between the new Shape.Length and the static Length field to the Percent field. Any polylines that intersected the polygon boundary will have a percentage less than 100.
- Split the polyline at each vertex,
- for each segment call completely within on the end points,
- any segment that is completely within has 100% of its length within the polygon, (assuming no re-entrant polygons), and its length can be added to a total,
- any partial lines can be split into say 10 segments and the same calculation applied.
- Compare the total with the length calculated to get a resolution of 10%, (if you need more accurate results then you can sub-divide finer on the partial lines).
- You could even keep a total of the lengths of the totally outside lines as well and only do the partial line calculation only if you have neither answer past your threshold.