等高线回放水平偏差计算方法 Python

import arcpy

import os


arcpy.env.overwriteOutput=True


Table=arcpy.env.scratchGDB


a=arcpy.GetParameterAsText(0)


a1=arcpy.GetParameterAsText(1)


b=arcpy.env.scratchGDB+os.path.sep+"Contour_b"

b1=arcpy.env.scratchGDB+os.path.sep+"Contour_b1"

out_table=arcpy.env.scratchGDB+os.path.sep+"out_tb"

# height1

height_ori=arcpy.GetParameterAsText(2)

# height2

height_end=arcpy.GetParameterAsText(3)

# interval

height_interval=arcpy.GetParameterAsText(4)


Table_name=arcpy.GetParameterAsText(5)


Output_Feature_Class = arcpy.env.scratchGDB+os.path.sep+"output"


height1=int(height_ori)

height2=int(height_end)

interval=int(height_interval)


Number=(height2-height1)/interval+1


arcpy.MakeFeatureLayer_management(a,b);

arcpy.MakeFeatureLayer_management(a1,b1);


arcpy.CreateTable_management(Table,Table_name, "", "");

arr=[];

str1=[];

N=height1

i=0

while N<=height2:

    arcpy.SelectLayerByAttribute_management(b, "NEW_SELECTION", "Contour =  "+str(N))

    arcpy.SelectLayerByAttribute_management(b1, "NEW_SELECTION", "Contour =  "+str(N))

    ## Process: Feature To Polygon

    arcpy.FeatureToPolygon_management(b+";"+b1, Output_Feature_Class, "", "ATTRIBUTES", "")

    arcpy.Statistics_analysis(Output_Feature_Class, out_table, "Shape_Area SUM", "")

    cursor=arcpy.da.SearchCursor(out_table,"SUM_Shape_Area")

    row=cursor.next()

    arr.append(row[0])

    N=N+interval

while i<Number:

    arcpy.AddField_management(Table+os.path.sep+Table_name, "Contours_"+str(height1+i*interval), "DOUBLE")

    str1.append("Contours_"+str(height1+i*interval))

    i+=1


cursor1=arcpy.da.InsertCursor(Table+os.path.sep+Table_name,str1)

cursor1.insertRow(arr)



arcpy.Delete_management(Output_Feature_Class)

arcpy.Delete_management(b)

arcpy.Delete_management(b1)

arcpy.Delete_management(out_table)


等高线回放水平偏差计算方法 Python,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。