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?

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

1 Answer 1

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 and acknowledge you have read our privacy policy.

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