ArcGIS Pro - How to calculate distance from x orig/y orig to y dest/ y dest in an attributee table?

793
2
06-22-2020 07:21 AM
VincentLaunstorfer
Occasional Contributor III

Hi,

I have a point feature class in which I would like to calculate distance (possibly geodesic) with xy coordinates, origin and destination, stored within the table. I cannot find specific geoprocessing tool but I imagine it is possible with Field Calculator?

Thanks

Tags (3)
0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

If it's in projected coordinate system you could do a field calculation with Pythagoras relatively easily:

Distance =  SQRT[  (X1-X2)^2  + (Y1-Y2)^2  ]

but I would hazard that there's no need if you have these spatially located already. Also if you want to do geodesics you will have a lot of fun with the Haversine formula.

I would convert your destination points to a separate feature class then run 'Generate Near Table'. 

If this isn't an option if you have thousands of points a script could use the 'Near' tool, run selections on each feature, generate scratch outputs then merge them back into one feature.

0 Kudos
DanPatterson
MVP Esteemed Contributor

If you have a need for accurate geodesic values, use Vincenty.

You can pull out the requisite function from the attached.

It is set up to read long/lat from origin/destinations.


... sort of retired...
0 Kudos