Select to view content in your preferred language

How to Cut Lines at Points? Need Tips for Automating with Python

201
4
12-12-2024 03:18 AM
GIS_Rookie
Occasional Contributor

Hi everyone,

I’m working on a project using LiDAR data to scan lines, and I’ve run into a challenge I hope someone here can help with.

Long story short: the line wires were not connected, so I extended the parallel lines by 5m and generated points where the extended lines intersect. However, I’m now stuck trying to figure out how to cut the lines at these intersection points and remove the small, useless segments that were created by the extension.

Here’s an example image of the situation:

GIS_Rookie_0-1734002238367.png

 

Does anyone have ideas or tips for automating this process using Python? Any help or pointers would be greatly appreciated! 

P.s. I don’t have the license to use the Split Line At Point tool.

 

Thanks in advance!

Best regards,

GIS_Rookie

Never stop learning
Tags (2)
0 Kudos
4 Replies
RyanUthoff
MVP Regular Contributor

What you should be able to do is use the Split Line at Point tool. Select your line layer and the point layer that you created where the lines intersect. This will split the lines at each point. Then, you can just do a select by attribute based on the length column and delete any lines 5m or less (this is assuming that you don't have any legitimate lines that are 5m or less that you need to keep).

0 Kudos
GIS_Rookie
Occasional Contributor

Thank you for the suggestion, but unfortunately, I don’t have the license to use the Split Line At Point tool. Is there a workaround for this? I’m open to using Python if that’s an option. Could you share the logic or steps I could follow to achieve the same result programmatically?

Never stop learning
0 Kudos
RyanUthoff
MVP Regular Contributor

I'm sure there are workarounds.....but it's outside of my area of knowledge. If you don't have access to that tool, then I think you'll have to use Python. Here are a couple of links that might be helpful. Both links include a Python script that avoids using that tool because they don't have an advanced license.

I haven't tried using those scripts, but it might point you in the right direction.

Split line at a point with ArcGIS 10.1 Basic level license? - Geographic Information Systems Stack E...

arcpy - Standalone Python script to split a polyline with a point layer - Geographic Information Sys...

 

0 Kudos
RobertKrisher
Esri Regular Contributor

If there isn't already a vertex where the lines cross you may be able to use the Snap tool to snap the endpoints of those two lines together. It only requires a standard license and has the added benefit of not needing to delete any dangling lines.

0 Kudos