在Arcpy中获取了一个.shp上的几何元素,如何获取该几何元素的attributes
import arcpy
g = arcpy.Geometry()
geometryList = arcpy.CopyFeatures_management("E:/myMapData/New_Shapefile.shp",g)
length = 0
for geometry in geometryList:
length += geometry.length
print(s)
print "Total length: %f" % length
#这是获取几何元素的方法
import arcpy
srcRows = arcpy.SearchCursor("E:/myMapData/New_Shapefile.shp")
for row in srcRows:
s=row.getValue("Id")
print(s)
#获取Id
Id和几何元素都能单独获取到,我应该怎么将两者对应上
2 个回复
turtle
赞同来自: 潘建伟 、慕晓燕 、谢峥
参考数据访问模块下的searchcursor类
http://resources.arcgis.com/zh-cn/help/main/10.2/index.html#/na/018w00000011000000/
看一下示例代码,里面能找到答案
谢峥
赞同来自:
要回复问题请先登录或注册
发起人
相关问题
问题状态