I need to take x number of points and equally/spatially divide them into groups. Meaning that if I had 40 points like in the image below and wanted to have 4 groups of points. Each group should have 10 points and all the points should be spatially near each other. I have tried using normal K-means cluster but that only spatially correlates data while not taking into account the even number of points in each group. I have tried writing this in JavaScript as well as Python. Does anyone have any thoughts on what would be the best way to go about evenly and spatially splitting a set of points?
Asked
Active
Viewed 475 times
2
-
1You have this tagged with PostGIS, Python, and JavaScript, but don't have any code for any of them in the question. Please choose one solution framework and provide what you have attempted so far. – Vince Dec 19 '18 at 13:26
-
@Vince Is there any reason why I cannot choose more than one framework? Limiting a solution to one framework would not make since if I can use a variety of frameworks. I can provide the code for what I have previously done. – mkeller Dec 19 '18 at 13:28
-
We have a "One question per Question" policy here in GIS SE. Leaving the solution language open effectively makes this N questions. – Vince Dec 19 '18 at 13:32
-
Ok, I will delete this and post the same question 3 different times for each framework. – mkeller Dec 19 '18 at 13:34
-
No, don't delete, just focus. It's better if you choose one environment and work that through resolution, instead of having to maintain three questions at once. – Vince Dec 19 '18 at 13:37
-
That is the opposite of what I want to do. :) I dont want to be locked into one environment. I already am focused on what I would like to resolve, which is clustering points. Now, whether getting that solution via code is in PostGIS, Python, or JavaScript any of those will work for what the application I am designing. I do not want to limit myself to one framework while multiple solutions can work. If limiting people to one framework per question is a limitation of GIS SE, then I have no choice but to post three times based off of what you noted. – mkeller Dec 19 '18 at 13:43
-
Well, one approach would be to start with k-means, and then to reassign from groups with too many points to groups with too few, based on closeness, until you get an even number in each group. I can't think of a fully deterministic approach to this problem (k-means isn't either). I doubt it matters whether you use Postgres, Javascript or Python – John Powell Dec 19 '18 at 14:35
-
https://gis.stackexchange.com/questions/123289/grouping-village-points-based-on-distance-and-population-size-using-arcgis-deskt/123297#123297 – FelixIP Dec 20 '18 at 02:47
-
@FelixIP So is that going from one corner, continually selecting the closest polygons until that group reaches a certain threshold. After that threshold is met, a new group is started and it continues to select the next closest polygon until that threshold is complete. Continue till all polygons selected. – mkeller Dec 20 '18 at 14:39
-
No, it compares polygons nearest to pgon A and pgon B in all pairs. – FelixIP Dec 20 '18 at 19:31
-
https://gis.stackexchange.com/questions/250113/clustering-neighboring-points-inside-arcgis-desktop/250230#250230 – FelixIP Dec 20 '18 at 19:54
-
This is a useful question, I have the same issue. And similar to the OP, I don't care about the tool, I care about the solution. – Dan Gayle Jan 01 '19 at 18:57
-
Maybe you should go that way... http://blog.cleverelephant.ca/2018/06/polygon-splitting.html – Cyril Mikhalchenko Jan 04 '19 at 19:07
-
@Cyril Close, but this does not evenly divide the points! This evenly splits the area of all your points and does not take into consideration that you want the points to be evenly split. – mkeller Jan 07 '19 at 13:49
-
Maybe I didn't quite get the auto-translation of your question right, I'm sorry... – Cyril Mikhalchenko Jan 07 '19 at 15:26
