批量裁剪GDB

导入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"
    

 

图片如下:

posted @ 2014-01-21 17:48  月之圣痕  阅读(640)  评论(0编辑  收藏  举报