Is there a way to automatically delete vertices in line features using a polygon file in ArcGIS so that it wouldn't cut up the line but just straightens the line inside the polygon?
The lines are lines and the box represents a polygon that covers them. I want to delete line vertices that are inside the polygon so the line would be straight inside the polygon boundary like on the illustration.
I use ArcGIS 10.1 but have access to other software also if something offers the solution.
Answer
Here's where an Advanced license will be useful.
- Use the Clip tool to clip the "Line" feature class (FC) by the "Polygon" FC. Name the output "Lines_Inside".
- Use the Erase tool to do the opposite, and erase the lines that fall inside the polygons. Name the output "Lines_Outside".
- For the "Lines_Inside" FC, use the Feature Vertices to Points tool specifying the "BOTH_ENDS" option to create a point for the start and end node of each line. Create a field called "LineID" that uniquely identifies which line each start and end point belonged to (you can do this using a Join or Spatial Join or Selection or otherwise). Unfortunately I don't have an Advanced license in front of me to test the exact steps.
- Use the Points to Line tool on your results from Step #3 to create straight-line segments out of the start and end points of the original "Lines_Inside" FC. You will have to specify your "LineID" field you created in Step #3 for the "Line_Field" parameter.
- Merge/Append/Data Load the results of Step #4 to your "Lines_Outside" FC to get the two FCs back together.
- Use the Unsplit Line tool or Dissolve tool to merge the parts back together into single lines. You may have to do a Spatial Join to get the attributes back in the middle segments (which you generated) prior to running the tools.
Hope this helps. I can add screenshots when I'm able to access an Advanced license if you need them. The only other solution I can think of if these steps don't work would be to mess with the list of vertices in the arcpy.array object for each arcpy.polyline in your FC, which would be doable without the Advanced license but significantly harder without some Python skills.
No comments:
Post a Comment