1

I have a polyline shp file, which has 3 routes. I need to find the overlap segments of any two routes, and then merge all the overlap segments with the original 3 routes to get a new polyline shp file for the further analysis. Now my method is to use two iterations to obtain the results. The following picture shows the method I used for now. In the model, AllRoute.shp includes route0, route1 and route2.

enter image description here

However, I have to use the same method for 500 routes. Can anyone help me with adding another iteration to the existing model?

6
  • 1
    There can be only one iterator per model so you need to use a submodel. However, I suspect this would be a lot easier to do using ArcPy.
    – PolyGeo
    Aug 10, 2016 at 20:21
  • Hi PolyGeo, I made it by using Python script. Thanks.
    – Tianxin Li
    Aug 10, 2016 at 23:57
  • Excellent - it would be great if you could post your script as an answer to benefit the next people facing the same scenario. It is perfectly OK and encouraged to answer your own question and even to accept it.
    – PolyGeo
    Aug 11, 2016 at 0:59
  • Hi PolyGeo, I am sorry that I don't know how to format the code. Your edits would be appreciated.
    – Tianxin Li
    Aug 11, 2016 at 2:07
  • I've formatted it (highlighted text then clicked the {} button) but please now cut/paste it into an answer. At the moment you have an "answer" in your question which does not follow our protocols for focussed Q&A. Be sure to take the 2-minute Tour to learn more about how the site works.
    – PolyGeo
    Aug 11, 2016 at 2:11

2 Answers 2

1
import arcpy

arcpy.env.workspace = "C:/Users/TL/Desktop/ModelTest/SeperateRoutes"

featureClasses = arcpy.ListFeatureClasses()

i = 1

for fc1 in featureClasses:
    j = 1
    for fc2 in featureClasses:
        inputFC = [fc1, fc2]
        outputFC = "C:/Users/TL/Desktop/ModelTest/Intersect/Intersect%sto%s.shp" % (i, j)
        arcpy.Intersect_analysis(inputFC, outputFC, "ALL", "", "LINE")
        j += 1
    i += 1


print "Done!"
0

I am not certain about what you are trying to accomplish (a picture might help) but I have a suspicion that it may be easier to accomplish by converting your polyline features into linear route events so that you can overlay them within a single process using Overlay Route Events:

Overlays two or more event feature layers against a target network and outputs a feature class or event table that represents the union of the input.

1
  • I have some background for the Python, but never used Arcpy before. As I go over the tutorial, I noticed that the Arcpy would give me more freedom to realize the things I want. Anyway, thanks to your comments for the question I posted here.
    – Tianxin Li
    Aug 10, 2016 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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