ArcGIS10.1 python 提取面的所有拐点坐标到属性字段中

0
分享 2013-08-16
也许你会有这样的需求,是要把面数据的所有拐点坐标提取出来存储到一个属性字段中使用,但是又不想大费周折的写一些AO、AE甚至是addin的程序,那么你可以选择是哟个python来完成你的工作。示例代码如下,在arcgis10.1中通过测试
def MySub(feat):    
partnum = 0
#multipart feature
partcount = feat.partCount
pntcount = 0
str=''
# Enter while loop for each part in the feature (if a singlepart feature
# this will occur only once)
while partnum < partcount:
part = feat.getPart(partnum)
pnt = part.next()
# Enter while loop for each vertex
#
str=str+"["
while pnt:
pntcount += 1
px='%f' %pnt.x
py='%f' %pnt.y
str=str+px+","+py +";"
pnt = part.next()

# If pnt is null, either the part is finished or there is an
# interior ring
if not pnt:
str=str[:-1]
str=str+"]"
pnt = part.next()
partnum += 1
return str

文章来源:http://blog.csdn.net/esrichinacd/article/details/8772380

0 个评论

要回复文章请先登录注册