# Generate clusters of X points within N meters

I have a set of roughly 4,000 points in very close proximity and I need to generate clusters of 5 points, with each point no farther than 50 meters from the (mean?) center of the cluster. I've explored various tools in ArcMap, especially in the analysis and spatial statistics toolboxes, though I can't seem to find a tool that will do the trick. I know that I would need roughly 800 clusters, but I'm not sure how to derive them from the point data.

The buffer solution mentioned here won't work because the points in my data set are in such close proximity that buffering each point and then dissolving would create one or two large polygons that cover most of the data set. Also, I need to each point in my data set to be assigned to a cluster, while creating as few clusters as possible (a small number of clusters with less than five points is acceptable). • possible duplicate of Find Clustered Points Within X Distance with N Points
– Fezter
Dec 6, 2013 at 6:13
• It may seem strange that we are voting to close your Question when you have already mentioned that you are aware of the earlier one which we are suggesting it is a duplicate of. The reason for me voting this way is that I would prefer you to use the original Q&A to try and clarify whether the "buffer solution" actually works or not first, and then if you still think there is something unique about your question, to edit it and focus it on that uniqueness.
– PolyGeo
Dec 6, 2013 at 7:19
• Edited to clarify why the buffer solution won't work here and to further clarify the question. Dec 6, 2013 at 7:35
• The key to whether this is a duplicate will be whether the requirement in both Questions is the same. To me "find me the points where each cluster has 10 points within 50 meters" sounds quite similar to "4,000 points in very close proximity and I need to generate clusters of 5 points, with each point no farther than 50 meters from the (mean?) center of the cluster". I will try to do some careful editing on the other question to try and remove any superfluous content.
– PolyGeo
Dec 6, 2013 at 8:25
• This is a very difficult problem if an optimal (or even near-optimal) solution is desired. It would help if you could explain why you want to do this clustering. Dec 6, 2013 at 14:36

Your goals are somewhat contradictory for multiple reasons. So here is the typical problem with assigning with the X points within N meters criteria. Consider a set of points on this simple map below where 1 indicates the existence of a point.

``````01100
11100
11000
``````

Lets say that we want a cluster when we have 4 points within 2 meters (pretend that the above map spans 3 meters in the Y axis and 5 meters in the X axis). For this set of data, this would result in the points being assigned to the following clusters.

``````0xx00
y?x00
yy000
``````

The `?` mark symbolizes that that particular point can be assigned to either the `y` cluster or the `x` cluster. The Crimestat program has a tool that will do just this task called Fuzzy Mode and it will return both the `y` and the `x` cluster centers each with 4 points assigned if that is what you really want.

Given your stated end goal of

I need to each point in my data set to be assigned to a cluster, while creating as few clusters as possible

I would perhaps suggest using another clustering scheme such as hierarchical clustering or k-means. If the end goal is to obsfucate the data, it reminds me a bit of this question How can I generate irregular grid containing minimum n points?