I am trying to compute shortest distance to stream from various point locations on the landscape. I am using the cost path tool in spatial analyst to do this . I am using a DEM as a cost distance raster and flow direction raster as a cost back link raster. The tool runs fine. What I see is where there are points close to each other multiple paths merge( as it is supposed to according to the algorithm).

"When multiple paths merge and follow the remaining distance back to a source on the same route, the segment where the two paths travel together is assigned the value 2. The merged portion of the path cannot be assigned the value of one of the paths, since the merged portion belongs to both routes."

I am later converting this cost path raster layer to a polyline to compute geographic distances of each path. But the problem is with these lines coded as "2". They are not attached to the parent line. How do I covert cost path to polylines( one line for each point from source to destination). I tried the unsplit lines tool but it still puts the "2s" as separate line segment.

I'm using ArcMap 10.1.


I've not done that workflow before, so someone else may have a better answer.

One solution would be to export your "2" lines to a new feature class, then Spatial Join your "2" feature class to your initial paths with a JOIN-ONE-TO-MANY join type. This should duplicate the "2" lines once for each path they touch (depending on spatial relationship selected, such as intersect, touches boundary, etc.), and then you could Dissolve on path id in the results to get a single line for the full length of each path.

This method's effectiveness would be limited by the complexity of the branching though. I'm not clear if "2" means two or more paths shared, or explicitly means just two. If two paths come together, the rest is merged but what happens if a third path joins that merged one later on? That could require some iteration of the process or careful editing so you don't end up with a multi-part path. A screenshot of what you're working with might be helpful here.


You could use the merge tool to merge the lines coded with '2' with the parent lines.

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.