2

I have a set of about 120,000 points, not regularly spread. enter image description here I would like to cluster them in order to create groups of about 3,000 points, regardless the distance. The final goal is to create polygons (their size is not important, I just want them to contain 3,000 points) out of bbox from these groups. The result would be like a grid with different sizes of cells, each cell containing 3,000 points. Do you know how could I achieve this ? I saw st_clusterKmeans and st_clusterDBSCAN functions, but I don't know how to fix the number of points to aggregate (there's a minpoints with st_clusterDBSCAN, but no "maxpoints").

Vince
  • 20,017
  • 15
  • 45
  • 64
Arn
  • 21
  • 2
  • See if my answer here can do what you want; it's based on a WITH RECURSIVE approach, rerunning ST_ClusterDBSCAN on clusters with too many points. A smaller params.fraction value will increase execution time, but the amount of points per cluster will be closer to the params.max_points value. The goal was to get below params.max_points, not divide by exactly params.max_points points, so cluster sizes will vary below that threshold. Grid cells may very likely overlap, too. – geozelot Nov 27 '19 at 13:50
  • your final polygons could be overlaped ? – obchardon Nov 27 '19 at 17:18

0 Answers0