# Finding points a certain distance from each other

I would like to find the maximum amount of points within a specified domain that are a certain distance from each other. For example, how many points within an area are 1000ft from each other? I envision each point with a radius of the desired distance, but I don't know if I must start with a point or what.

-
Welcome @Laura to GIS SE, can you update your example? – artwork21 Jan 31 '12 at 18:08
Sorry, yes. For example, how many points within an area are 1000ft from each other. I envision each point with a radius of the desired distance, but I don't know if I must start with a point or what. – Laura Jan 31 '12 at 18:41
It's hard to see what an answer to your question would look like, Laura. The criterion ("a certain distance from each other") applies to point pairs, not to points, so in what sense does counting just points relate to that criterion? – whuber Jan 31 '12 at 19:11
I see what you mean. Say, I have a plot of land and I want to fit the maximum amount of benches in the allotted space but they cannot be within 1000ft of any of them - I guess not within a 1000ft radius. – Laura Feb 2 '12 at 17:57

It sounds to me that you would get an answer to your question by creating a subset of your points dataset and running Near analysis (if you're using ArcGIS) on it subset choosing it as both: near and input features. Description of that tool. Having done this you would be able to choose points that have a neighbor in the same dataset within certain distance.

-

Just from the sound of it, you want to pick a point and buffer it 1000ft, then give a total of how many points are within that buffer. Is that correct? If, so you just need to loop through each point and buffer it a 1000ft, then take the buffer and do a spatial query, could be a within or contains, to get the total count. I do not know if you are using ArcGIS, QGIS, etc., but basically that is the process.

1. Buffer point of interest
2. Use buffer geometry to perform a spatial query to get count of points within
the geometry
3. Repeat until finished.
-

If you're interested in a Python implementation of what Jamie suggests, try running this code (adjust paths to data accordingly in lines 4,5,8,9,10):

note: untested Tested/Confirmed

import arcpy

# buffer points
arcpy.env.workspace = "C:/GIS/temp"
arcpy.Buffer_analysis("pointData.shp", "C:/GIS/temp/pointDataBuffer.shp", "1000 Feet", "#", "#", "NONE")

# spatial join and count the number of points falling inside of each buffer
target_features = "C:/GIS/temp/pointdataBuffer.shp"
join_features = "C:/GIS/temp/pointData.shp"
out_feature_class = "C:/GIS/temp/pointDataBufferJoin.shp"

arcpy.SpatialJoin_analysis(target_features, join_features, out_feature_class)

The join_count field which is created in your pointsDataBufferJoin file will tell you how many points matched up ("Intersected") with each 1000 foot buffer.

-