尝试遍历多个空间范围以创建 4 个不同层的 17 个并集。
我正在运行 ArcGIS Desktop 10.0、ArcInfo(高级)。
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)
错误代码(不是很有帮助):
inList: [u'Road_ProcGrid_1', u'FPs_S_ProcGrid_1', u'er_di_ProcGrid_1', u'TV_v_ProcGrid_1']
回溯(最后一次调用):文件“E:\Projects\TV\01_Python\LandCover\LC_2_Vector_Tile_6class_091312.py”,第 48 行,在 arcpy.Union_analysis([InList], ws + "/" + "TVvis6class_G" + str( i)) 文件“C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py”,第 483 行,Union raise e RuntimeError: Object: Error in execution tool
我知道这是关于 ArcGIS 的编程论坛,但我也在 esri 论坛上发过帖子,有很多意见,但反馈很少。如果我为特定范围手动选择每个数据集,则该工具本身会运行,因此问题必须出在编码中。
感谢您的任何想法。
富有的