3

I am trying to find the average distance from several points in a layer to points in another layer. I am using ArcMap Basic - I know there is a way to do this using the Advanced version of ArcMap but was wondering if anyone knew a workaround for Basic (if it exists).

1

I think the ArcPy answer will be to SearchCursor through your two feature classes and use an InsertCursor to write a new table with values calculated according to this algorithm:

import math
dist = math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))

which is the Python equivalent of AML's INVDISTANCE function.

This approach would give you the distance from every point in one feature class to every point in another. If you are only interested in those up to a certain distance just write records when the distance returned is greater than this threshold.

1

If you are only looking to find the 1st nearest point, the easiest method would be to use Spatial Join with the match_option set as CLOSEST. This will return the attributes of the join_features point closest to each target_features point.

If you need to find many nearest points (e.g. the 1st through 10th nearest points) to each point and you have lots of points (n > 100,000), it will be much faster to create a Python script that uses the cKDTree module from SciPy.

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.