首页 > 编程语言 > 详细

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

时间:2014-03-14 21:37:07      阅读:685      评论:0      收藏:0      [点我收藏+]

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,布布扣,bubuko.com

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

原文:http://blog.csdn.net/xiang__jiangsu/article/details/21252145

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!