Populating an attribute inside a loop

المشرف العام

Administrator
طاقم الإدارة
New to python scripting. One of the issues I have been working on is trying to get a script to calculate the elevation gained in each stream section based on a single input and the knowledge of the elevation at that height. I have the code written so it can make all the correct selections but my issue comes from trying to get the script to fill in the attribute table after. If anyone has used the book Python scripting for arcgis this is the exercise 2-8 in the book.
Fields -Elevation gained (this is a field that contains a single number about how much elevation is gained in each section.) Flowline_out (this is the bottom section of every segment of creek. The first one is a known number, after that the Flowline_out is the result of the last segments flowline_in)Flowline_in ( this is the top part of each segment. This number is generated from the addition of elevation gained to the flowline_out)

I am trying to use the update cursor

fields = ("Flowline_In","FLowline_Out","Elevation_Gained") elcursor = arcpy.da.UpdateCursor("AnalysisCreeks",fields) for row in elcursor: i = arcpy.getValue("Flowline_Out") + arcpy.getValue("Elevation_Gained") row[0] = i cursor.UpdateRow(row) del elcursor, row

أكثر...
 
أعلى