Select to view content in your preferred language

Is there a point distance tool work-around?

752
2
10-29-2010 11:10 AM
DavidEckley
Emerging Contributor
I only have an ArcEditor license but am wondering if the ArcInfo point distance tool (calculating the distance between all possible points within a feature class) can be accomplished with a script work-around?  ArcEditor has tools to calculate distance between closest points but not between every point in the feature class.

Thanks for any insight!
0 Kudos
2 Replies
KimOllivier
Honored Contributor
How hard can it be?! The maths to calculate the distance between two points could use good old Pythagoras once you have the point coordinates in a list.

The numbers may balloon out because the product of the two sets will often be large. To reduce this, use the Python module itertools  in 2.6 to generate the permutations of the point pairs n*(n-1)/2 so that you don't measure to-from as well as from-to (n*n). To make running through lists repeatedly more efficient, load the ID,x,y for each point into a Python structure such as a dictionary. Numpy has a function to do the maths even faster than Pythagoras implemented in a script.
distance = numpy.linalg.norm(x-y)
0 Kudos
DavidEckley
Emerging Contributor
Thanks again, Kim!  This really is helpful.

(I guess it's so easy that ESRI will only provide the tool in it's Info license!)
0 Kudos