I have a series of polygons I have converted to points. I want to have qGIS automatically assign them into subgroups of 15 points that are near each other.

So I want something like this to occur:

enter image description here

I found a tool description in archGIS that appears to do exactly what I want, but can't find the equivilant in qgis. (The tool is here: Grouping Analysis (Spatial Statistics)

I can't figure out which tool in QGIS to use. I've seen elsewhere to try the concaveHull plugin, but I can't get that to work right. Regardless of what I set the 'Number of neighbors' and 'Find SNN Clusters' values to, it creates just a single shape with only one record.

What am I missing?


The trick with the Concave Hull plugin is, that it adds two functionilities to the Processing Toolbox.

Maybe you have to activate them under Processing -> Options -> Provider -> Concave hull by k-nearest neighbors

In the Processing toolbox, then look for Shared Nearest Neighbor Clustering. You will need to experiment on the number of neighbors there. It will return a new point layer with the grouping numbered from 1 to n.

The second function Concave hull (k-nearest neighbors) can then be used to make a polygon around those clusterd points with the method "based on field".

I actually have also no idea what the function of the ConcaveHull plugin in the Vector-menu, that you described, is good for. But the other two processing functions do what you want to achieve, I think.

Alternativly, go to Plugins -> Manage and Install Plugins ... and search for "cluster". 4 other plugins show up then, which I did not test so far.

| improve this answer | |
  • Thanks, that is a lot closer to what I want, however the limiting doesn't appear to work? despite setting 'number of neighbors' = 5 – user3773291 Oct 21 '16 at 16:54
  • Man, that 'enter' button is tricky. As I was saying, for 'shared nearest neighbor clustering' in that processing thing, if i set 'number of neighbors' = 5 and run it, it does make clusters approximately by location, which is great, but each cluster is not limited to 5 points each. It takes my selection and breaks it into 5 clusters. Is there a way to say "I want a bunch of groups of 5" rather than "5 groups of a bunch"? – user3773291 Oct 21 '16 at 16:55
  • 2
    sorry, didn't get notified about your comments. The number of neighbors is not the amount of points per cluster, but the number of points taken into consideration for the statistical operation ( I think). For any advanced statistical problems, I now try to use R instead of hard-coded plugins. Have a look at r-bloggers.com/spatial-clustering-with-equal-sizes (only as an example of a similar problem) – Bernd V. Dec 3 '16 at 13:16
  • Thanks. So looks like there isn't an easy 'one button click' solution plugin for qGIS for this type of problem and R is the way to go. – user3773291 Dec 5 '16 at 18:08

How about the Attribute Based Clustering Plugin?


Look at the Rule Based Styles.

There are several tutorials out there such as https://nathanw.net/2011/06/06/one-of-my-favorite-features-of-qgis/

| improve this answer | |
  • Thanks, but I must not be conveying my question correctly: The rule based colors would work if I already knew the grouping. – user3773291 Oct 20 '16 at 20:12
  • Sorry, hit enter too soon: In my case, I don't know what the groups are. For example, I have 500 points. I want it divided into sub groups of 15 based on where they are near each other. The output would be "Group 1" , "Group 2", etc..... THEN I could have colors added and whatnot. But first i need qGIS to separate my data into groups. – user3773291 Oct 20 '16 at 20:14
  • @user3773291 updated answer – kttii Oct 20 '16 at 21:10
  • Thanks for helping me try to hunt this down. Appreciate your thoughts. Unfortunately that appears to be the opposite of what I'd want. From the first paragraph: "equally interesting is the clustering by attributes, when the spatial position of the object plays no role (only if it is not formalized as an attribute), and significant are some of its numerical characteristics." I am looking for the opposite- spatial position of the object plays the whole role - 'are these points near each other' - and there isn't a field in the attribute table that should be look at at all. Thanks! – user3773291 Oct 20 '16 at 21:18

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.