使用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

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值