Trying to loop through multiple spatial extents to create 17 unions of 4 different layers.
I'm running ArcGIS Desktop 10.0, ArcInfo (advanced).
Gridnums = range(1,18)
for i in Gridnums:
#vis6class = ws + "/" + "TVvis6class_G" + str(i)
inList = arcpy.ListFeatureClasses("*ProcGrid_"+str(i), "")
print "inList: " + str(inList)
arcpy.Union_analysis([InList], ws + "/" + "TVvis6class_G" + str(i))
print "Union completed for Grid " + str(i)
arcpy.AddField_management(vis6class, "Object", "TEXT", 10)
arcpy.AddField_management(vis6class, "Revert", "SHORT")
rows = arcpy.UpdateCursor(vis6class)
for row in rows:
row.Revert = 0
if row.Road == 1:
row.Object = Road
rows.updateRow(row)
elif row.Water == 1:
row.Object = Water
rows.updateRow(row)
elif row.Building == 1:
row.Object = Building
rows.updateRow(row)
else:
row.Object = row.Landcover
rows.updateRow(row)
Error Code (not very helpful):
inList: [u'Road_ProcGrid_1', u'FPs_S_ProcGrid_1', u'er_di_ProcGrid_1', u'TV_v_ProcGrid_1']
Traceback (most recent call last): File "E:\Projects\TV\01_Python\LandCover\LC_2_Vector_Tile_6class_091312.py", line 48, in arcpy.Union_analysis([InList], ws + "/" + "TVvis6class_G" + str(i)) File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 483, in Union raise e RuntimeError: Object: Error in executing tool
I know this is programming forum over ArcGIS, but I've posted onto the esri forums as well, with lots of views but little feedback. The tool itself runs, if I manually select each dataset for a particular extent, so the problem has to be in the coding.
Thanks for any thoughts.
Rich