arcpy批量近邻分析,不同的道路

# encoding: utf-8
import os
import arcpy
from arcpy import env
path=r"D:\data\polygon"
dl=r"D:\data"
for fc in os.listdir(path):
    if(fc.endswith(".shp")):
        fcname=fc.decode('GBK').encode('utf-8')
        polygonpath=path+"\\"+fcname
        print polygonpath
        dlpath=dl+"\\"+fcname[0:len(fcname)-4]
        print dlpath
        env.workspace=dlpath
        features=arcpy.ListFeatureClasses()
        for fea in features:
                if(fea!="边界.shp"):
                    arcpy.Near_analysis(polygonpath, fea)

                    print fea
目录结构

 

转载自:https://blog.csdn.net/A873054267/article/details/88088043

You may also like...