root_path = "E:\\GIS RS\\20230305\\"
corresPolygon = "corresPolygon"+str(int(input_point.X * 1000))+"_"+str(int(input_point.Y * 1000))+".shp"
在使用arcpy.CreateFeatureclass_management()函数时,输入参数必须分开写,先写根目录,再写文件名,如下:
arcpy.CreateFeatureclass_management(root_path,corresPolygon,"POLYGON",spatial_reference = spatial_ref)
这样才不会报错。
要是提前定义为:
corresPolygon ="E:\\GIS RS\\20230305\\corresPolygon"+str(int(input_point.X * 1000))+"_"+str(int(input_point.Y * 1000))+".shp"
再执行如下:
arcpy.CreateFeatureclass_management(corresPolygon,"POLYGON",spatial_reference = spatial_ref)
则会报错。