zoukankan      html  css  js  c++  java
  • arcgis 面或线要素类上的搜索游标

    import arcpy
    
    infc = arcpy.GetParameterAsText(0)
    
    # Identify the geometry field
    #
    desc = arcpy.Describe(infc)
    shapefieldname = desc.ShapeFieldName
    
    # Create search cursor
    #
    rows = arcpy.SearchCursor(infc)
    
    # Enter for loop for each feature/row
    #
    for row in rows:
        # Create the geometry object
        #
        feat = row.getValue(shapefieldname)
    
        # Print the current multipoint's ID
        #
        print "Feature %i:" % row.getValue(desc.OIDFieldName)
        partnum = 0
    
        # Step through each part of the feature
        #
        for part in feat:
            # Print the part number
            #
            print "Part %i:" % partnum
    
            # Step through each vertex in the feature
            #
            for pnt in feat.getPart(partnum):
                if pnt:
                    # Print x,y coordinates of current point
                    #
                    print pnt.X, pnt.Y
                else:
                    # If pnt is None, this represents an interior ring
                    #
                    print "Interior Ring:"
            partnum += 1     

    对于上述要素类,脚本将返回以下信息。要素 0 是单部分面,要素 1 是两部分面,而要素 2 是带有内部环的单部分面。

    Feature 0:
    Part 0:
    3.0 8.0
    1.0 8.0
    2.0 10.0
    3.0 8.0
    Feature 1:
    Part 0:
    5.0 3.0
    3.0 3.0
    3.0 5.0
    5.0 3.0
    Part 1:
    7.0 5.0
    5.0 5.0
    5.0 7.0
    7.0 5.0
    Feature 2:
    Part 0:
    9.0 11.0
    9.0 8.0
    6.0 8.0
    6.0 11.0
    9.0 11.0
    Interior Ring:
    7.0 10.0
    7.0 9.0
    8.0 9.0
    8.0 10.0
    7.0 10.0
  • 相关阅读:
    【NX二次开发】Block UI 组
    【NX二次开发】Block UI 双精度表
    【NX二次开发】Block UI 整数表
    自己写的简单的轮播图
    微信分享到朋友圈----摘录
    HTML5比较实用的代码
    苏格拉底的名言警句
    jQuery 幻灯片 ----摘录
    DeDe调用指定栏目ID下的文章
    JQuery 判断ie7|| ie8
  • 原文地址:https://www.cnblogs.com/gisoracle/p/10845069.html
Copyright © 2011-2022 走看看