3

I'm trying to calculate the distance between the centroids of adjacent records (adjacent in the attribute table, not necessarily in space) into an attribute field. I'm planning on using the truecentroid.x and truecentroid.y properties of one record and the next record in the attribute table with the Pythagorean theorem to calculate distance. but can't figure a way to get to the properties of the next record. I'm not a great programmer but I can usually hack something together.

Can someone suggest a starting point for me?

  • Populate additional field by oid-1 and join to itself – FelixIP Aug 16 '17 at 20:24
  • Perfect! That was the solution. I'd completely forgotten to follow the KISS principal. Keep It Simple Stupid. – user103866 Aug 16 '17 at 22:58
  • Might not work on database fc if oid is not sequential – FelixIP Aug 17 '17 at 10:01
  • @FelixIP Looks like you have almost two sentences and an answer in your comments. – PolyGeo Aug 20 '17 at 8:46
1

Populate additional field by OID - 1 and join to itself.

Please note that solution will always work for shapefiles (FID), but might fail for database feature class if OBJECTIDs are not sequential numbers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.