导入shape,批量裁剪GDB。
代码如下:
# -*- coding: utf-8 -*- import os.path import arcpy from arcpy import env arcpy.env.workspace = 'D:/AllDB/china.gdb' output = "D:\Test" clipshp = "D:\need\SmallRegion.shp" print 'processing...' for fds in arcpy.ListDatasets(): if not fds == '': for fc in arcpy.ListFeatureClasses('','',fds): outputfeature=output+"\"+fc+".shp" arcpy.Clip_analysis(fc,clipshp,outputfeature,""); print fc+"@Done" for sfc in arcpy.ListFeatureClasses(): outputfeature=output+"\"+sfc+".shp" arcpy.Clip_analysis(sfc,clipshp,outputfeature,""); print sfc+"@Done"
图片如下: