有示例要素类如下
经过下面代码处理
1 #遍历输出面或折线要素的折点坐标 2 #infc:输入要素类
# code source: https://www.cnblogs.com/yzhyingcool/
# QQ:975601416 3 import arcpy 4 infc='test'; 5 for row in arcpy.da.SearchCursor(infc,["OID@","SHAPE@"]): 6 print("Feature{}:".format(row[0]+1)) 7 part_num=1 8 for part in row[1]: 9 print("Part{}:".format(part_num)) 10 pnt_num=1 11 for point in part: 12 if point: 13 print("Point{}:{},{}".format(pnt_num,point.X,point.Y)) 14 else: 15 print("Interior Ring:") 16 pnt_num-=1 17 pnt_num+=1 18 part_num+=1
输出结果如下:
Feature1:
Part1:
Point1:307986.868613,2036382.79113
Point2:309272.746184,2038049.66947
Point3:312050.876741,2036430.41623
Point4:308224.994089,2032668.0337
Point5:307986.868613,2036382.79113
Feature2:
Part1:
Point1:315262.924831,2034551.87081
Point2:311431.750502,2029366.0271
Point3:308224.994089,2032668.0337
Point4:312050.876741,2036430.41623
Point5:315262.924831,2034551.87081
Interior Ring:
Point6:310500.415306,2033281.86827
Point7:310767.883637,2032127.53126
Point8:312278.418862,2032477.53332
Point9:312010.950532,2033631.87033
Point10:310500.415306,2033281.86827
Feature3:
Part1:
Point1:303639.755752,2046537.51978
Point2:304942.334224,2048376.45409
Point3:308005.389483,2046206.78995
Point4:306702.811011,2044367.85563
Point5:303639.755752,2046537.51978
Feature4:
Part1:
Point1:304526.111691,2037573.41852
Point2:303779.985199,2034922.28821
Point3:302208.357056,2037097.16756
Point4:304526.111691,2037573.41852
Part2:
Point1:302052.252577,2040551.30989
Point2:300597.041333,2036979.42774
Point3:298315.005519,2041113.5506
Point4:300828.552213,2045016.16257
Point5:302052.252577,2040551.30989