Connecting a broken line segment

312
0
04-02-2014 02:10 PM
Emilbrundage
New Contributor III
I'm working with a line feature representing a pipeline. There are breaks in the line with no feature. I would like to fill in those breaks with lines. Currently I'm basically drawing lines with end points and deleting anything over a certain length, but it's not perfect. Sometimes the gaps are larger, for example.

Is there a tool that does this for me by chance? It would essentially select feature end points that are closest to one another and create line features from them. It would also ignore the first start and last end point.

Thanks!

#create end points from merged pipeline
arcpy.FeatureVerticesToPoints_management (thePipeLine, "PipeLineEndPoints", "BOTH_ENDS")
#create lines from end points
arcpy.PointsToLine_management ("PipeLineEndPoints", "EndPointLns", Close_Line = "CLOSE")
#split line at verticies
arcpy.SplitLine_management ("EndPointLns", str(Geodatabase)+"\\SplitEndLines")
#Create layer from end point lines
arcpy.MakeFeatureLayer_management (str(Geodatabase)+"\\SplitEndLines","EndPointLineslyr")
#Select long lines >20 meters
arcpy.SelectLayerByAttribute_management ("EndPointLineslyr", "NEW_SELECTION", '"Shape_Length" >20')
#Delete long lines >20 meters
arcpy.DeleteFeatures_management ("EndPointLineslyr")
#Merge pipeline with gap lines
arcpy.Merge_management ([thePipeLine,str(Geodatabase)+"\\SplitEndLines"], "ConnectedPipe")
Tags (2)
0 Kudos
0 Replies