I'm writing a program to count the number of times a polyline self-intersects. I create a new feature class to keep track of the line and the number of intersections. The feature class is created with the appropriate fields but it is not populated with the information. So I simplified the code to just look at the search cursor and insert cursor (as shown below) and this simple code does not populate the attribute table. I've used a similar code before to create a feature class and populate the table and it works fine. This seems like it should work, does anybody see anything wrong with this? (This is typed directly into the Python window in the ArcMap document containing the feature class). The fields intCount and Trip_ID are type double.
import arcpy
Fields = ['SHAPE@','intCount','Trip_ID']
insCur = arcpy.da.InsertCursor("Bikemap_SelfInt",Fields)
with arcpy.da.SearchCursor("BikemapTC_linesTEMP",["SHAPE@","trip_id"]) as cursor:
intCount = 0
for row in cursor:
segments = row[0]
trip_id = row[1]
intCount +=1
insCur.insertRow([segments, intCount, trip_id])
del insCur
insCur.insertRow((segments, intCount, trip_id))
– BERA Mar 19 '20 at 10:52del insCur
– Vince Mar 19 '20 at 11:08