五月天青色头像情侣网名,国产亚洲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ó)家法律
安西县| 双鸭山市| 胶南市| 金川县| 雷山县| 南木林县| 囊谦县| 横山县| 甘德县| 大厂| 扬州市| 岱山县| 平塘县| 亳州市| 汉中市| 开封市| 根河市| 菏泽市| 永春县| 海阳市| 嘉善县| 绍兴县| 盐城市| 略阳县| 连平县| 密云县| 浙江省| 八宿县| 广南县| 酒泉市| 永兴县| 德保县| 阳东县| 宁波市| 买车| 阿鲁科尔沁旗| 噶尔县| 鹤庆县| 凤山县| 常宁市| 苍南县|