I have two point layers, related to each other by a common ID, but with very different locations.

I'd like to join them based on the ID field, but I'd also like to have the distance between them as an attribute.

My first idea was generating a line between the points with a common field and then getting its length. However, I don't know a tool that draws a line between separate point layers based on a common field.

I have a way to workaround this, but it seems messy: I run Generate Near Table and it gives me all the possible relations between all points from feature A and all points from feature B. I run two attribute joins to get back the attributes from each table and, after that, I can select only the records where tableA.commonField = tableB.commonField.

Would it be a better way to do it? I'm using Esri Software.

  • The arcpy.geometry object has a distanceTo method. Using cursors you could get each row , get the ID, query the second table, get both points and use them to generate the distances. Aug 10 '16 at 2:47
  • Add geometries (xy) to both layers. Add field distance to one of them. Join second table to 1st using common field. Calculate distance between two pairs of coordinates using e.g. Pythagorean theorem
    – FelixIP
    Aug 10 '16 at 5:52

Your Answer

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

Browse other questions tagged or ask your own question.