输出表circ2D
中没有值:
需要为每个多边形添加字段circ2D
为值circ2D
添加填充:
arcpy.AddField_management(theme, "circ2D", "DOUBLE", field_length=13)
for row in arcpy.da.SearchCursor(theme, ["FID","SHAPE@"]):
print ("Polygon # {}: ".format(row[0]))
for part in row[1]: # Inside the polygon
xCoords = []
yCoords = []
zCoords = []
for pnt in part:
print (" {}, {}, {} ".format(pnt.X, pnt.Y, pnt.Z))
xCoords.append(pnt.X)
yCoords.append(pnt.Y)
zCoords.append(pnt.Z)
perim2D = lab4_arcpy_module.definePerimeter(xCoords, yCoords)
area2D = lab4_arcpy_module.defineArea(xCoords, yCoords)
cirRatio2D = lab4_arcpy_module.defineCircularRatio(area2D, perim2D)
arcpy.CalculateField_management(theme, "circ2D", str(cirRatio2D))
但是,cirRatio2D实际上已经计算并进入打印声明。
可能有什么问题?