<div>Hello Brent,</div><div><br></div><div>Thanks for your help also. I saw this method, but I cannot use it in my scenario as it is too imprecise.</div><div><br></div><div>Consider all points as agents that interact with each other, each up to a certain range. I need to find interaction clusters and cannot afford to have those split in many parts, though it is ok to miss including some points.</div>

<div><br></div><div>Sébastien</div><br><div class="gmail_quote">On Tue, Dec 7, 2010 at 15:06,  <span dir="ltr"><<a href="mailto:pcreso@pcreso.com">pcreso@pcreso.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">Hi Sébastien ,<br><br>One way I "clustered" points in the (distant) past for a zoom-layer mapping solution was to create multiple geometries, by reducing the number of decimal points in the X & Y coords and grouping by these locations. Simplistic & not especially statistical, but given a random point distribution you get an order of magnitude reduction in the number of positions of points at each step. With a non-random distribution, the reduction in number of these clusters is often greater. <br>

<br>I have also done a similar thing by creating grids of square cells of appropriate sizes, then assigning points to the cells using Postgis queries,  which allows a regular clustered sampling of the points by grid cell.<br>

<br>If you are after a more statistical approach, I'd look at using R, and once you have your R clustering capability coded, perhaps
 look at PL/R to embed the clustering capability within your database.<br><br>What isn't clear from your question is whether the clustering is something done often, perhaps at various resolutions, or is done once, to assign points to clusters, then used as these groups from then on. This would have an impact on performance & the approach you might take.<br>

<br>Also note that with both Postgis & R, any use of multiple cores or hardware clusters will require some work, as these are not applications that parallel process particularly well, but you could perhaps develop code that assigns individual analyses of data clusters to a load balanced hardware cluster. <br>

<br>If you have a clusterin algorithm, it may also be feaqsibl to implement it as a native user defined Postgis/Postgres function, but I think PL/R is an easier approach for embedded SQL clustering capability.<br><br><br>

HTH,<br><br>  Brent Wood<br><br>--- On <b>Wed, 12/8/10,
 Sébastien Lorion <i><<a href="mailto:sl@thestrangefactory.com" target="_blank">sl@thestrangefactory.com</a>></i></b> wrote:<br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px">

<br>From: Sébastien Lorion <<a href="mailto:sl@thestrangefactory.com" target="_blank">sl@thestrangefactory.com</a>><br>Subject: Re: [postgis-users] Determining clusters of points<br>To: "PostGIS Users Discussion" <<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a>><br>

Date: Wednesday, December 8, 2010, 8:03 AM<div><div></div><div class="h5"><br><br><div>I like your idea very much, especially since something I did not say is that the points have a range attribute which determines how far they can interact with other points. So the circle buffer you talk about would have a diameter equals to the range of each point.<div>



<br></div><div>What would be fastest as the last step : bounding box, minimum bounding circle or minimum convex hull ? I am guessing the BB, but is the difference significant enough that one should be chosen over another ?</div>



<div><br></div><div>Sébastien<br><br><div>On Tue, Dec 7, 2010 at 13:42, Emilie Laffray <span dir="ltr"><<a rel="nofollow" href="http://mc/compose?to=emilie.laffray@gmail.com" target="_blank">emilie.laffray@gmail.com</a>></span> wrote:<br>

<blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">

<div><div></div><div><br><br><div>On 7 December 2010 17:01, Sébastien Lorion <span dir="ltr"><<a rel="nofollow" href="http://mc/compose?to=sl@thestrangefactory.com" target="_blank">sl@thestrangefactory.com</a>></span> wrote:<br>



<blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Hello,<div><br></div><div>I am trying to find an efficient way to find clusters of points as shown in the attached image. The only clustering criteria is the distance between the points. The dataset can be very large (millions of points) and point distribution is mostly clustered with some sparse points in the gaps.</div>






<div><br></div><div>I searched the net and this mailing list and found two promising solution paths: </div><div><br></div><div>- use a statistical tools such as R with a density function (<a rel="nofollow" href="http://www.r-project.org/" target="_blank">http://www.r-project.org</a>)</div>






<div>- use a clustering algorithm like those explained here <a rel="nofollow" href="http://www.med.nyu.edu/biostatistics/people/Ilana%20Belitskaya-Levy/Courses/MAS/Handouts/clustering.pdf" target="_blank">http://www.med.nyu.edu/biostatistics/people/Ilana%20Belitskaya-Levy/Courses/MAS/Handouts/clustering.pdf</a> (agnes seems the most promising for my purposes)</div>






<div><br></div><div><a rel="nofollow" href="http://www.med.nyu.edu/biostatistics/people/Ilana%20Belitskaya-Levy/Courses/MAS/Handouts/clustering.pdf" target="_blank"></a>I would like your advice to help me find which approach would be best suited with PostGIS (maybe there is even something already made that I can use?). Whatever solution I pick, it must be efficient and the workload must be able to be distributed on a cluster of commodity hardware.</div>






<div><br></div><div>I am new to GIS and this mailing list, so please excuse me if I am not using the right vocabulary.</div><div><br></div><div>Thank you very much!</div><br></blockquote></div><br></div></div>Hello,<br><br>



Some time ago I have worked on something similar, except that I was using circles instead of boxes which should not be a problem. I am just giving the logic as I don't have access to the code right now.<br>
You can start by creating a buffer around each of your points of the distance you want. <br>The next step is to create an UNION of all the buffers that intersect.<br>You get the list of points included in each of the resulting polygons and then you create either a bounding box around them or use a minimum bounding circle (Postgis 1.5 and above).<br>




<br>Emily Laffray<br>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a rel="nofollow" href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br></div>
</div><br></div></div>-----Inline Attachment Follows-----<div class="im"><br><br><div>_______________________________________________<br>postgis-users mailing list<br><a href="http://mc/compose?to=postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>

<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></div></div></blockquote></td></tr></tbody></table></blockquote>

</div><br>