I have a number of polylines (around 9000), a number of which have one or both ends touching another polyline. I would like to merge these ones together into one polyline - thus reducing the number of polylines and ensuring that each line represents one real-world object (rather than having multiple lines per object).

I cannot find a scriptable (preferably through a Python script) way to do this.

Is this possible?


Try the Dissolve tool with the UNSPLIT_LINES option.

Aggregates features based on specified attributes.


  • The Unsplit lines parameter with two options, DISSOLVE_LINES and UNSPLIT_LINES, only applies to line input. When the default DISSOLVE_LINES option is specified, lines are dissolved into a single feature. When UNSPLIT_LINES is specified, only two lines that have a common endpoint (known as pseudonode) are merged into one continuous line.
  • I was about to recommend this, here is the python equivalent in 9.3.1 and will need to be adjusted to either run in v10 or outside of the ArcGIS python/command line window. Dissolve_management("Road","C:/gis/data/temp/road_d.shp","Road_Name","SHAPE.len SUM","MULTI_PART","UNSPLIT_LINES")
    – SaultDon
    Jan 19 '11 at 16:06

Haven't tested it but should work nonetheless.

IFeature polyline, polyline2;
ITopologicalOperator op = polyline.Shape as ITopologicalOperator;
polyline.Shape = op.Union(polyline2);


  • Sounds great. I'll have to have a look at the ArcObjects API, I haven't used it before. Do you know if there is an equivalent operation I can do in Python?
    – robintw
    Jan 19 '11 at 14:02
  • @robintw I think you should be able to use the code provided and create a toolbox. Then that toolbox can be called from the modelbuilder.
    – Brad Nesom
    Jan 19 '11 at 14:41

if your ArcGIS comes with Data Interoperability extention, LineJoiner transformer is able to do your task. BTW, Data Interoperability is built from FME, you can see how that transformer works here: http://www.fmepedia.com/index.php/LineJoiner


I found that the basic dissolve tool works much better than the multipart-->singlepart then unsplit lines approach.

  • 1
    Hi Pat, Welcome to GIS.se :) One line answers are discouraged. The meat of the Q is about a scriptable method for joining, you could improve your answer by expanding on how basic dissolve addresses this, as well as perhaps explaining why or how dissolve works better for this job in your experience. May 17 '13 at 20:06

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.