[postgis-users] Find polygons grouping points

Rémi Cura remi.cura at gmail.com
Mon Jun 23 05:08:12 PDT 2014


Hey,
your question is to imprecise to get a good answer (better have a schema /
test case, and better describe your problems).

If you mean : given a set of points, find the 5 polygons that have the same
number of points (up to 1 if n_points%5 !=0), adding possibly a constraint
on there shape (polygons should be more or less smoth for instance), it is
a very hard problem.
You can try to solve it by graphcut for instance, or any other optimization
algorithms. This kind of solutions are way beyond postgis.

Now if your points have a more or less predictable distribution with nice
features, you could use the kmeans algorithm to cluster your points into 5
groups, then generate the envelope (alpha shape) of each group.

You could also use the property of voronoi cells and iteratively merge it
(region growing).

If your point distribution is very regular, you could use very basic
geometric approach like drawing a pentagon over your points and split it in
5 equal parts
, hoping that they will contain the correct number of points.

Either way what you want is called "clustering" and you can use many
different approaches, depending on your data and requierement (
http://en.wikipedia.org/wiki/Cluster_analysis).

Cheers,
Rémi-C


2014-06-23 12:58 GMT+02:00 <kinju59 at gmail.com>:

>   Hello all,
>
> I have a geographic zone containing points, and I would like obtain 5
> polygons containing each of them the same (+/-) number of points.
>
> Sometime a polygon will be small, sometime it will big, but both will
> contain +/- the same number of points they contain.
>
> Is it possible to do that with Postgis ?
>
> Thank you for your help,
>
> kin
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140623/edfaeb03/attachment.html>


More information about the postgis-users mailing list