Thanks, This is what I ended up with:

select b.slice, st_convexhull(st_collect(a.the_geom)) as hull from
     (SELECT * FROM function_returning_points() ) as a,
     (select generate_series(500, 1500, 500) as slice) as b
where a.dist <= b.slice group by b.slice order by b.slice;

This is somewhat simplified from the actual query but I think it is doing what I want.

-Steve

On 8/24/2011 3:51 PM, Robert Hollingsworth wrote:
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




_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to