import arcgisscripting
gp=arcgisscripting.create(9.3)
gp.workspace="D:/test"
try:
    gp.MakeFeatureLayer("D:/test/sheng.shp", "sheng")    
    gp.SelectLayerByAttribute("sheng", "NEW_SELECTION", "zonecode=45000000")
    gp.SelectLayerByLocation("sheng", "SHARE_A_LINE_SEGMENT_WITH", "sheng") #空间查询
    #gp.CopyFeatures("sheng", "d:/test/bbb.shp")
    result = gp.GetCount_management("sheng")
    count = int(result.GetOutput(0))
    print count
    desc = gp.Describe("sheng")
    fields = desc.Fields
    rows = gp.SearchCursor("sheng")
    row=rows.Next()
    while row:#遍历记录
        print row.zonecode
        #for field in fields:  #遍历字段
         #   print row.GetValue(field.Name)
        print "*****************"
        row=rows.Next()  
    print "ok"
except:
    print gp.getMessages(2)

相关文章:

  • 2021-05-03
  • 2021-09-02
  • 2021-09-29
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
猜你喜欢
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
相关资源
相似解决方案