How to use arcpy.Geometry() and attribute table

المشرف العام

Administrator
طاقم الإدارة
I have Polygon layer (*.shp) and I need to calculate shortest distance between every polygon's and save it into a txt file with ID (it is in attribute table) for every polygon.

example of txt file - ID_a ; ID_b ; a.distanceTo(b)

this code works but I have no idea how can I get data from attribute table to it?

input = 'layer.shp'

geometries = arcpy.CopyFeatures_management(input,arcpy.Geometry())x=0y=1z=1 for one in geometries:
count = len(geometries) - z
for geometry in range(count):
a = geometries[x]
b = geometries[y]
distances.write(str(x)+"\t"+str(y)+"\t"+str(a.distanceTo(b))+"\n") y=y+1
x=x+1
z=z+1
y=x+1
distances.close()

Thank you very much!



أكثر...
 
أعلى