Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have line feature class of a river network and “FromTo” table. Lines are dissolved so they are not segmented from junctions. I need to write a Python script in ArcGIS to do following:

  1. Begin from the first row in Hydro feature class attribute table and get its ID
  2. Insert this ID into “From” field in “FromTo” table
  3. Get ID(s) of line(s) which intersect(s) first line (e.g. second line intersect first line)
  4. Inset ID into “To” field in FromTo table

For second loop

  1. Get ID of second row in Hydro feature class attribute table

  2. Insert this ID into “From” field in “FromTo” table

  3. Get IDs of lines which intersect second line (e.g. first and third lines intersect second line)

  4. Inset IDs into “To” field in FromTo table

  5. So on…

Perhaps, you show a different way in order to get the same result by Python

enter image description here

share|improve this question
Are you trying to do Strahler stream ordering with vector data? This describes the raster alternative… – PolyGeo Oct 4 '12 at 22:20
@PolyGeo: No, just trying to get connectivity of the network by creating this FromTo table. – user10727 Oct 4 '12 at 23:07

Between those commands you can do most of what you're asking for.

Update: As per Accessing data using cursors there is now a new data access module (arcpy.da). The previously existing cursors are still functional and valid; however, the new arcpy.da cursors include significantly faster performance

share|improve this answer

Since you appear to be just wanting to know where your lines intersect, and which lines intersect at those locations, before going to Python, you may want to try:

  1. Intersect with just the one input feature class - works for all license levels
  2. Tabulate Intersection if you have ArcGIS 10.1 for Desktop Advanced
share|improve this answer

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.