ARCGIS读取Excell数据生成多边形Python脚本

来源:互联网 发布:鸟倦飞而知还的而用法 编辑:程序博客网 时间:2024/05/18 05:40
import xlrd,xlwt,arcpy... xlsPath = r'F:\Lot.xls'... data = xlrd.open_workbook(xlsPath)  ... table = data.sheets()[0]#通过索引顺序获取  ... cols = table.col_values(3) ... nrows = table.nrows... point = arcpy.Point()... array = arcpy.Array() ... polygonGeometryList = [] ... cur =  arcpy.InsertCursor("d:\\polygon.shp")... for i in range(1,nrows): ...     str = table.cell(i,3).value...     name = table.cell(i,2).value...     points = str.split(';')...     for j in points:...         xy = j.split(',') ...         print xy[0] ...         print xy[1]...         print '\n'  ...         point.X = float(xy[0]);...         point.Y = float(xy[1])...         array.add(point)...     row = cur.newRow()...     row.shape = array...     row.name = name...     array.removeAll() ...     cur.insertRow(row)