本文主要是介绍使用ArcGIS字段计算器计算要素(线、面要素)的拐点坐标,线面,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用ArcGIS字段计算器计算要素的拐点坐标(线,面要素)
打开字段计算器,如下图,选择python,显示代码块,粘贴以下代码。dd=GetpointXY( !Shape! ),参数选Shape字段。
def GetpointXY(feat):
partnum = 0
# Count the number of points in the current multipart feature
partcount = feat.partCount
pntcount = 0
# Enter while loop for each part in the feature (if a singlepart
# feature this will occur only once)
pointxy=""
while partnum < partcount:
part = feat.getPart(partnum)
pointxy+=str(partnum+1)+":"
pnt = part.next()
# Enter while loop for each vertex
while pnt:
pntcount += 1
if pnt:
pointxy+=str(pntcount)+":"+str(pnt.X)+","+str(pnt.Y)+";"
pnt = part.next()
# If pnt is null, either the part is finished or there
# is an interior ring
#
if not pnt:
pnt = part.next()
partnum += 1
return pointxy
这篇关于使用ArcGIS字段计算器计算要素(线、面要素)的拐点坐标,线面的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!