Python - 在shapefile之间循环交叉

时间:2018-03-21 03:39:58

标签: python intersection arcpy

我需要针对1个人口普查区域文件为10个气候文件编写一个循环(在arcpy中)。因此,我需要10个十字路口。在命名输出文件时我的语法有问题:我得到ERROR 00800。

我知道这与连接有关,对许多人来说可能很容易。自从我用Python编写代码以来已经有一段时间了。在下面找到我的代码,感谢您的帮助

output2 = ""
shapes_input =["RCP4_2040_1", "RCP4_2040_2"]                      
for shapes in shapes_input:
output = shapes + "_AU"
output2 = '"' + output + '"'
arcpy.Intersect_analysis(shapes, "AKLmbAU2013", output2)

1 个答案:

答案 0 :(得分:0)

您想要获得output2的价值的是:

RCP4_2040_1_AU

通过包含引号获得的内容:

"RCP4_2040_1_AU"

因此,您传递arcpy.Intersect_analysis(shapes, 'AKLmbAU2013', 'RCP4_2040_1_AU')而不是预期的语法arcpy.Intersect_analysis(shapes, 'AKLmbAU2013', '"RCP4_2040_1_AU"'),即您的变量值包含引号。只要把它们关掉就可以了。