Arcgis将一个shp依照属性表导出为多个shp

# -*- coding:utf-8 -*-

import arcpy
import os

from arcpy import env

#env.workspace = "./" #自己设置路径

shp = r'C:\Users\Administrator\Desktop\Lake\xxx.shp' #shp文件路径

outpath = r"C:\Users\Administrator\Desktop\Lake\fenli" #输出结果路径

with arcpy.da.SearchCursor(shp,["SHAPE@",'lake_id'])as cursor:
##SHAPE@指代单个要素,lake_id是一个字段,该字段也是我们想要作为每个polygon命名的值,也可以改为其他的字段如name
    for row in cursor:
        outname = str(row[1])+'.shp'
        arcpy.FeatureClassToFeatureClass_conversion(row[0],outpath,outname)

Arcgis将一个shp依照属性表导出为多个shp_第1张图片

 

你可能感兴趣的:(GIS,arcgis)