Selecting and Merging using Model Builder

266
1
05-16-2013 09:30 PM
MANESK
by
New Contributor III
I have a polyline feature class with around 5000 records. The task is to merge the two consecutive polylines into a polyline.
So if i merge all the 5000 records i would have 2500 records(2500 lines)in that file.
I need this to be done in Model Builder which is new for me..Kindly help me to complete this task..
0 Kudos
1 Reply
RichardFairhurst
MVP Honored Contributor
I have a polyline feature class with around 5000 records. The task is to merge the two consecutive polylines into a polyline.
So if i merge all the 5000 records i would have 2500 records(2500 lines)in that file.
I need this to be done in Model Builder which is new for me..Kindly help me to complete this task..


I am not clear why only two consecutive lines would merge and not any amount of consecutive lines that share the same attribute and that connect.  If the latter is what you want to do then the Dissolve tool or Create Route Features tool will do everything you need.  Leaving the Multipart option of Dissolve unchecked for Dissolve or the Ignore Gaps option unchecked for the Create Route Features tool will ensure that only lines that touch end to end will merge together.  However, either of these tools will still merge every line that touches end to end and that shares the same attribute, not just 2 of those lines at a time.

If on the other hand you are requiring that no more than 2 consecutive lines would merge, even when more lines are consecutively end to end with each other, that would have to be done using a Python script that does a very custom combination of tools and Python cursor operations.  Part of it could be designed in ModelBuilder, but the final step would require exporting the model to a Python script and inserting a Python cursor loop to do the final line pair merge.  That script could then be made into a geoprocessing script tool itself and brought back into ModelBuilder, but then you would have to design some additional scripting to make the output of that tool chain in ModelBuilder with other tools properly.

So please first look at the Dissolve tool or Create Route Features tool and let me know if those tools do what you want to do or not, since they would be the simplest solution for use with ModelBuilder, before I suggest a work flow that requires significant customization to get the end product you want.
0 Kudos