Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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? It would seem to me like a fairly common operation to want to do, but I can't seem to find a built-in function.

share|improve this question

4 Answers 4

up vote 6 down vote accepted

Try the Dissolve tool with the UNSPLIT_LINES option.

share|improve this answer
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);


share|improve this answer
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

share|improve this answer

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

share|improve this answer
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. –  matt wilkie May 17 '13 at 20:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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