arcpy.env.workspace = os.getcwd() outName = r"polyline.shp" polylineGeometryList = [] # a list to hold the PointGeometry objects spRef = arcpy.SpatialReference(4326)
## 读取excel,获取站点关联线段 excelFile=path wb=excel.load_workbook(excelFile) ## 读取第一行,获取列头 sheet=wb["Sheet1"] rows=sheet.max_row columns=sheet.max_column dic={} ## 存储列名与列号的对应 for i inrange(1,columns+1): dic[sheet.cell(row=1,column=i).value]=i
## 遍历剩余的行,根据对应关系求坐标 polylinGeometryList=[] for i inrange(2,rows+1): start_n=str(sheet.cell(i,dic['start_n']).value)