# Finding points close together

I am using ArcGIS desktop. I want to run a tool to find all points that are close to each other within a specific distance.

What is the fastest and best tool to use? I am using the standard arcgis with the Spatial Analyst extension.

• Near (Analysis) Toolbox resources.arcgis.com/en/help/main/10.2/index.html#//…
– Mapperz
Commented Aug 14, 2013 at 20:28
• @Mapperz According to the documentation, each point is associated only with its closest neighbor: that does not solve this problem, which seeks all points within a given distance. Is there perhaps some other mode in which `Near (Analysis)` works that does solve this problem? Commented Aug 14, 2013 at 21:52
• Near has a {location} & {search_radius} parameter that can be used, which is optional.
– Mapperz
Commented Aug 15, 2013 at 1:46
• Point Distance tool does not allow the X,Y coordinates to be written. But it is almost identical code in ArcGIS to Near.
– Mapperz
Commented Aug 15, 2013 at 1:49

To do this I would use the Point Distance tool which:

Determines the distances from input point features to all points in the near features within a specified search radius.

The best way for points if you have a large number is to use the geohash module for Python. This is hundreds of times faster than Near and very flexible. But if you only have a few, just use Near. http://en.wikipedia.org/wiki/Geohash

``````import Geohash
# .... make a dictionary of the point coordinates
for row in arcpy.SearchCursor(inputFC):
d[row.getValue(pk)] = [row.getValue(keyatt),
Geohash.encode((row.shape.firstPoint.Y),(row.shape.firstPoint.X),precision=10)]
# ... compare the dictionaries, if they are the same geohash they are within the same tolerance.
def valuesChanged(dict1, dict2,sBoth):
'''get a list of keys from one dict if a corresponding dict's values are different'''
outList = [key for key in sBoth if dict1.get(key) != dict2.get(key)]
return outList
``````
• The document cited recommends examining the 8 surrounding geohashes to be a robust proximity search. Commented Aug 14, 2013 at 22:30