[postgis-users] Clustering adjacent points into polygons

Bryan Montgomery monty at english.net
Tue Dec 18 11:34:49 PST 2012


Hello,
So we’ve been collecting gps data for months including the signal
strength of the cell signal. We’ve assigned this a strength value of 1
through 5 and null. These are about 19 millions of points that we have
recorded. I’d like to clump points within 250 feet of each other in to
one polygon.

I used the links below and tried that on a pretty small number and it
took it’s time but it worked, assigning a group to the points with the
same strength that were within the distance of another point. From
that I was able to make a polygon that covered all the points in the
same group. http://postgis.17.n6.nabble.com/Determining-clusters-of-points-tt3533366.html#a3533387
 or
http://answerpot.com/showthread.php?2021386-Determining+clusters+of+points.

However, running this against the whole table of points it is taking
forever, well days and still running.

I recently came across the new indexing with Postgis 2
(http://blog.opengeo.org/2011/09/28/indexed-nearest-neighbour-search-in-postgis/)
and thought that this might help with this task.

I also was wondering if it would make sense to create 5 sub-tables of
points, one for each signal strength? I'm not sure how well the btree
and gist indexes play together?

Could I do something like taking each point, then run a query for
points ordered by distance away from the point in the question and
then keep processing rows in a function until the distance exceeds the
threshold and then move on to the next point?

Thanks,
Bryan.


More information about the postgis-users mailing list