# edfncoding: utf-8 from __future__ import division from sklearn.cluster import KMeans import numpy as np import arcpy import pandas as pd from arcpy import env from sklearn.cluster import DBSCAN import os path=r"C:\Users\h\Desktop" filename="geleidaolu.mxd" outpath=r"d:\yincun" import arcpy.mapping as mapping mxd = mapping.MapDocument(path+"\\"+filename) count=0 for df in mapping.ListDataFrames(mxd): for lyr in df: count+=1 print lyr print outpath+"\\"+str(count)+".kml" arcpy.LayerToKML_conversion(lyr, outpath+"\\s"+str(count)+".kmz", 1)
#先将所有图层加入到mxd文档中