[postgis-users] How to extract multiple convex hulls from a query?

Robert Hollingsworth reh2 at prodigy.net
Wed Aug 24 12:51:36 PDT 2011


Steve,
I think I've done something similar with ST_ConvexHull( ), where I had a data set full of LINESTRING geometries and wanted to ConvexHull them into as many separate polygons as there are unique sets of values for two or three attributes stored on the objects. paraphrased below to obscure original detail:

SELECT
ST_ConvexHull ( ST_Collect ( the_geom ) ) AS poly,
table1.attr1,
table1.attr2,
table1.attr3
FROM
table1,
table2
WHERE
some condition AND
some other condition AND
GROUP BY
table1.attr1,
table1.attr2,
table1.attr3;

I think in your case if you could do something like this or similar?
select
func_returning_dist_as_one_of_5_ranges(the_distance) AS range,
ST_ConvexHull ( ST_Collect ( the_geom ) ) AS poly
from table
where....
GROUP BY range;

Hi all,

I am trying to construct multiple convex hulls from a series of point 
where  I have an attribute dist for each point.

What I want is to generate convex hulls for expanding rings where dist 
<= slice up to some max_dist.

So if slice=100 and max_dist=500, then each hull would be:

1. all points <= 100
2. all points <= 200
3. all points <= 300
4. all points <= 400
5. all points <= 500

So I have a procedure that generates the points and is fairly costly to 
run. I would like to run it once and extract all the hulls in a single 
pass if possible.

I'm currently running postgresql 8.3 and "POSTGIS="1.5.1" 
GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" 
LIBXML="2.6.32" USE_STATS"

Any thoughts or snippets would be appreciated.

Thanks,
   -Steve


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110824/91532a1b/attachment.html>


More information about the postgis-users mailing list