How can I cluster geographically 1886 polygons in QGIS knowing that I need 69 clusters with 27 polygons by cluster and one with only 23 polygons?
-
2Can you explain a bit better how you need to cluster them? (A naive way of doing it would be to take the 27 first polygons in one cluster, the 27 next one in the next and so on...)– MortenSickelCommented Mar 12, 2020 at 20:58
-
If doing it that way, you have no guarantee that the clusters will get togheter geographically if that is what you need– MortenSickelCommented Mar 12, 2020 at 21:29
-
1That's the issue, I need the clusters together geographically– Angel SerranoCommented Mar 12, 2020 at 21:51
-
Can you make a screenshot of your data set and scetch what you try do achieve? - edit your question to insert it.– MortenSickelCommented Mar 13, 2020 at 5:39
-
please use the edit link to add the constraints that you need to apply– Ian TurtonCommented Mar 13, 2020 at 9:40
Add a comment
|
1 Answer
Vector analysis -> K-means clustering is a good tool for clustering features geographically. You can specify the required number of clusters.
-
Just out of curiosity, do you know if it can it cluster the way Angel asked for - 69 clusters with 27 polys and one with 23 if you set it up for clustering in 70 polygons. Or would it be 66 with 27 and four with 26? (I do not have any dataset with 1886 polys around to test it on...) Commented Mar 13, 2020 at 13:12
-
@MortenSickel, I'm quite certain it cannot cluster exactly as Angel asked for. K-means minimizes within-cluster variance, and does to my knowledge not necessarily lead to evenly sized clusters.– SamCommented Mar 13, 2020 at 13:31