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
  • 相关阅读:
    招财铃计划 与 实现,
    present, visible,覆盖,系统行为,
    windows,navigationcontroller,stausbar, 20,充满,
    CSS伪类选择器:is、not
    CSS实现常用组件特效(不依赖JS)
    Iconfont技术
    Axios的基本使用
    axios和ajax,fetch的区别
    axios全攻略
    vue-loader作用
  • 原文地址:https://www.cnblogs.com/gisoracle/p/10845069.html
Copyright © 2011-2022 走看看