在arcpy中使用地理处理工具剪辑

时间:2016-04-09 01:25:11

标签: python clip arcpy

我试图在arcpy中使用地理处理工具(特别是缓冲区和剪辑),但不断收到此错误消息

更新:感谢您回答我的问题,我想我已经纠正了它,但我仍然得到同样的错误

arcpy.Buffer_analysis(in_features=(r"C:\Users\Michaelf\Desktop\GEOG M173\LabData\NA_Big_Lakes.shp"), out_feature_class="C:/Users/Michaelf/Desktop/GEOG M173/Buffered_Lakes6.shp", buffer_distance_or_field="50000 Meters", line_side="FULL", line_end_type="ROUND", dissolve_option="ALL", dissolve_field="", method="PLANAR")

arcpy.Buffer_analysis(folderpath + "\NA_Big_Lakes.shp", folderpath +\
                  "\Buffered_Lakes6", "50000 meters")

arcpy.Clip_analysis(in_features=(r"C:\Users\Michaelf\Desktop\GEOG M173\LabData\NA_Cities.shp"), clip_features="C:/Users/Michaelf/Desktop/GEOG M173/LabData/Buffered_Lake5.shp", out_feature_class="C:/Users/Michaelf/Desktop/GEOG M173/LabData/Clipped_Cities2", cluster_tolerance="")

arcpy.Clip_analysis(folderpath + "\NA_Cities.shp", folderpath + \
                "\Buffered_Lakes5.shp", folderpath + "\Clipped_Cities2")

当我运行它时,我得到与以前相同的错误,但是使用路径而不是文件。

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset NA_Cities.shp does not exist or is not supported
ERROR 000732: Clip Features: Dataset Buffered_Lake5.shp does not exist or is not supported
Failed to execute (Clip).

这是我的代码我是编程新手,因此不容易发现我做错了什么。 在此先感谢!!

import arcpy

arcpy.env.overwriteOutput = True

print 'Identifying the cities now...'


arcpy.Buffer_analysis(in_features=(r"C:\Users\Michaelf\Desktop\GEOG M173\LabData\NA_Big_Lakes.shp"), out_feature_class="C:/Users/Michaelf/Desktop/GEOG M173/Buffered_Lakes6.shp", buffer_distance_or_field="50000 Meters", line_side="FULL", line_end_type="ROUND", dissolve_option="ALL", dissolve_field="", method="PLANAR")

arcpy.Buffer_analysis(folderpath + "\NA_Big_Lakes.shp", folderpath +\
                  "\Buffered_Lakes6", "50000 meters")

arcpy.Clip_analysis(in_features="NA_Cities.shp", clip_features="Buffered_Lake5.shp", out_feature_class="C:\Users\Michaelf\Documents\ArcGIS\Default.gdb\Clipped_Cities2", cluster_tolerance="")

arcpy.Clip_analysis(folderpath + "\NA_Cities.shp", folderpath + \
                "\Buffered_Lakes5.shp", folderpath + "\Clipped_Cities2")

1 个答案:

答案 0 :(得分:1)

尝试从文件路径中取出空格:你有" GEOG M173"作为你的一个文件夹。可能来不及帮助你上课......