第1节 导出单个要素
#定义导出函数 def exportJpgByFid(fid): lyr.setSelectionSet("NEW",[fid]) adf.zoomToSelectedFeatures() ap.RefreshActiveView() mxd_jpg = ur"路径\{}.jpg".format(fid) mp.ExportToJPEG(mxd,mxd_jpg) lyr = mp.Layer(.shp) #.shp 转 .lyr #清除选择 lyr.setSelectionSet("NEW",[]) ap.RefreshActiveView() #获取图层要素个数 count = ap.GetCount_management(lyr) n = int(count.getoutput(0)) #循环打印 for i in range(n): exportJpgByFid(i)
1、用for遍历导出时;range读不到最后一个值 range(9) 读0-8
标签:lyr,jpg,ap,range,课本,第八章,fid,mxd From: https://www.cnblogs.com/Agiser0/p/17387478.html