Is there an efficient way to extend lines to points in ArcMap?

I have a utilities dataset, where I do not want to change the original geometry, but instead add to it in order for end vertices of lines tor each to the nearby junction points.

Point I want to extend to Desired output

I would not want to do this manually thousands of times. Is there a way to extend lines to points? I have tried extending the lines to themselves then snapping all within a certain tolerance, but this alters the original geometry. I have also tried integrating the lines, but again, it alters the original geometry.

After thinking a bit more, I am going to try and create points at the end vertices, then create lines from points using selected end vertices and the junctions, then I will merge the lines with the original polylines. My only concern is ensuring the attributes are appropriately merged and how to obtain an appropriate selection. I do not want to extend all lines, only certain ones. The rule is hard to put logically, but some lines used to intersect a cad feature, and others just ended near them...


This is what snap does: enter image description here

As one can see it is not what @Stella wants

The following workflow based on this structure of original pipes table: enter image description here

arcpy.FeatureVerticesToPoints_management("ORIGINAL","D:/Scratch/ENDS.shp", "BOTH_ENDS")
arcpy.AddField_management("ENDS","WHAT", "SHORT")
arcpy.CalculateField_management("ENDS", "WHAT", "!FID! % 2", expression_type="PYTHON_9.3")
arcpy.AddField_management("ENDS", "UNIQUE","TEXT", field_length="10")
arcpy.CalculateField_management("ENDS", "UNIQUE", expression="'%s %s' %( !LINE_ID!, !WHAT!)", expression_type="PYTHON_9.3")
arcpy.Near_analysis("ENDS","NODE", search_radius="", location="LOCATION")
arcpy.TableToTable_conversion(in_rows="ENDS", out_path="D:/Scratch", out_name="xy.dbf")

ADD XY data using NEAR_X and NEAR_Y fields from XY.dbf and convert them to DOUBLES.shp (no clue what ESRI did to this tool)

arcpy.PointsToLine_management("MERGED", "D:/Scratch/connections.shp", Line_Field="UNIQUE")

RESULTS: enter image description here

Because connections table contains parent pipe name in field UNIQUE:

enter image description here

it can be derived into a new field:

Afterwards connections can be merged with PIPES and result dissolved using LID. This is no brainer to bring attributes, e.g. DIAMETER, back from PIPES table.

Dissolving however will modify geometry, because without it you task cannot be accomplished.


Use the snapping (editing) tool.

I have been able to automate extending two line segments to snap together, setting a desired distance.

The tool allows you to use points, multipoints, lines, or polygons as the features you wish to snap to.

  • This will alter the original geometry. – Stella Jul 14 '16 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.