五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

arcpy開(kāi)發(fā)實(shí)例之管線自動(dòng)構(gòu)建

2022-11-11 10:09 作者:夕林泉石  | 我要投稿

# _*_ encoding: utf-8 _*_


import arcpy

arcpy.env.workspace = "d:/temp/pipe_data";


if arcpy.Exists("points.shp"):

? ? arcpy.management.Delete("points.shp");? ??

arcpy.management.CreateFeatureclass("d:/temp/pipe_data","points.shp","POINT",spatial_reference=arcpy.SpatialReference(3857));


if arcpy.Exists("lines.shp"):

? ? arcpy.management.Delete("lines.shp");? ??

arcpy.management.CreateFeatureclass("d:/temp/pipe_data","lines.shp","POLYLINE",spatial_reference=arcpy.SpatialReference(3857));


arcpy.AddField_management("points","expno","TEXT",5);

arcpy.AddField_management("points","mapno","TEXT",5);

arcpy.AddField_management("points","surfh","FLOAT");

arcpy.AddField_management("points","wdeep","FLOAT");


arcpy.AddField_management("lines","spoint","TEXT",5);

arcpy.AddField_management("lines","epoint","TEXT",5);


# 讀取XLS

import xlrd

xls = xlrd.open_workbook("d:/temp/pipe_data/ws_point.xlsx");

sht = xls.sheets()[0];

rn = sht.nrows;

cn = sht.ncols;


points = [];

with arcpy.da.InsertCursor("points",["expno","mapno","surfh","wdeep","SHAPE@XY"]) as cursor:? ??

? ? for i in range(1,rn):

? ? ? ? print " Read row : ",i;

? ? ? ? ctype = sht.cell_type(i,0);

? ? ? ? if ctype == 0:

? ? ? ? ? ? expno="";

? ? ? ? elif ctype ==1 :

? ? ? ? ? ? expno = sht.cell(i,0).value;

? ? ? ??

? ? ? ? ctype = sht.cell_type(i,1);

? ? ? ? if ctype == 0:

? ? ? ? ? ? mapno="";

? ? ? ? elif ctype ==1 :

? ? ? ? ? ? mapno = sht.cell(i,1).value;


? ? ? ? ctype = sht.cell_type(i,4);

? ? ? ? if ctype == 0:

? ? ? ? ? ? surfh=0;

? ? ? ? elif ctype ==1 :

? ? ? ? ? ?surfh = float(sht.cell(i,4).value);

? ? ? ? elif ctype==2:

? ? ? ? ? ? surfh = sht.cell(i,4).value;

? ? ? ? else:

? ? ? ? ? ? surfh = 0;

? ? ? ??

? ? ? ? ctype = sht.cell_type(i,5);

? ? ? ? if ctype == 0:

? ? ? ? ? ? wdeep=0;

? ? ? ? elif ctype ==1 :

? ? ? ? ? ?wdeep = float(sht.cell(i,5).value);

? ? ? ? elif ctype==2:

? ? ? ? ? ? wdeep = sht.cell(i,5).value;

? ? ? ? else:

? ? ? ? ? ? wdeep = 0;


? ? ? ? ctype = sht.cell_type(i,2);

? ? ? ? if ctype == 0 or ctype>2:

? ? ? ? ? ? continue;

? ? ? ? elif ctype == 1:

? ? ? ? ? ? x = float(sht.cell(i,2).value);

? ? ? ? else:

? ? ? ? ? ? x = sht.cell(i,2).value;


? ? ? ? ctype = sht.cell_type(i,3);

? ? ? ? if ctype == 0 or ctype>2:

? ? ? ? ? ? continue;

? ? ? ? elif ctype == 1:

? ? ? ? ? ? y = float(sht.cell(i,3).value);

? ? ? ? else:

? ? ? ? ? ? y = sht.cell(i,3).value;

? ? ? ??

? ? ? ? row = [expno,mapno,surfh,wdeep,(x,y)];

? ? ? ? points.append(row);

? ? ? ? cursor.insertRow(row);


# 讀取線表,并構(gòu)建線


xls = xlrd.open_workbook("d:/temp/pipe_data/ws_line.xlsx");

sht = xls.sheets()[0];

rn = sht.nrows;

cn = sht.ncols;


with arcpy.da.InsertCursor("lines",["spoint","epoint","SHAPE@"]) as cursor:

? ? for i in range(1,rn):

? ? ? ? print " Read row : ",i;

? ? ? ? ctype = sht.cell_type(i,1);

? ? ? ? if ctype !=1:

? ? ? ? ? ? continue;

? ? ? ? else :

? ? ? ? ? ? spoint = sht.cell(i,1).value;

? ? ? ??

? ? ? ? ctype = sht.cell_type(i,2);

? ? ? ? if ctype != 1:

? ? ? ? ? ? continue;

? ? ? ? else :

? ? ? ? ? ? epoint = sht.cell(i,2).value;


? ? ? ? for x in points:

? ? ? ? ? ? if x[0]==spoint:

? ? ? ? ? ? ? ? pt1 = x;

? ? ? ? ? ? ? ? break;

? ? ? ? for x in points:

? ? ? ? ? ? if x[0]==epoint:

? ? ? ? ? ? ? ? pt2 = x;

? ? ? ? ? ? ? ? break;

? ? ? ? arr = arcpy.Array();

? ? ? ? arr.append(arcpy.Point(pt1[4][0],pt1[4][1]));

? ? ? ? arr.append(arcpy.Point(pt2[4][0],pt2[4][1]));

? ? ? ? line = arcpy.Polyline(arr);

?

? ? ? ? row = [pt1[0],pt2[0],line];

? ? ? ? cursor.insertRow(row);


arcpy開(kāi)發(fā)實(shí)例之管線自動(dòng)構(gòu)建的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
同江市| 华阴市| 皋兰县| 北碚区| 盈江县| 永嘉县| 扶沟县| 马龙县| 琼结县| 洛浦县| 清苑县| 阜阳市| 龙川县| 京山县| 永仁县| 罗定市| 泗水县| 淳安县| 黔东| 芦山县| 平乐县| 浮梁县| 金坛市| 武邑县| 民勤县| 咸丰县| 铜山县| 达尔| 澄迈县| 高邮市| 板桥市| 汝南县| 惠安县| 深州市| 鲁甸县| 滨海县| 莱州市| 乌鲁木齐县| 二连浩特市| 广平县| 南宁市|