[postgis-users] ST_Collect

Hugues François hugues.francois at irstea.fr
Fri Oct 11 00:51:50 PDT 2013


I think the problem is a bit more complicated. The self join is the good approach but you can't collect the boolean output of st_dwithin. I should have tried something like
 
with myselect as (
    select a.id, a.geom, st_collect(b.geom) as b_geom from mytable a, mytable b
    where st_dwithin(a.geom, b.geom, 500)
    and a.id != b.id
    group by a.id, a.geom
    )
 
select a.id, st_collect(geom, b_geom) from myselect
 
Hugues.

________________________________

From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Carsten Hogertz
Sent: Friday, October 11, 2013 9:30 AM
To: PostGIS Users Discussion
Subject: [postgis-users] ST_Collect


Hello, 

I've got a question about using ST_Collect.

I have one table with hundrets of thousands of points. Within this table I want to collect the points that are within a 500 meter radius and calculate a convex hull around them.

Since the ST_DWithin needs (geom, geom, distance) and I only have one table with points, do I first have to perform a self join to identify the points within 500 meters and then a ST_Collect to group these points? Or can I somehow do it without joining the one table with itself?

And can I use the ST_DWithin inside the ST_Collect? Like ST_Collect(ST_DWithing(geom,geom,distance))?

Thanks for your help!
--
Carsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131011/eaad7ccd/attachment.html>


More information about the postgis-users mailing list