[postgis-users] Aggregate Intersection?

Curtis W. Ruck ruckc at yahoo.com
Wed Oct 4 21:23:06 PDT 2006


I just implemented this incase anyone wants it.  Yes its slow, yes it's stupid and assumes all data coming in is good.  But it will work for my application.

CREATE FUNCTION Intersection(in_polys geometry) RETURNS geometry AS $$
DECLARE
intersection_result geometry := GeometryN(in_polys, 1);
BEGIN
    FOR i IN 2..NumGeometries(in_polys) LOOP
        intersection_result := Intersection(intersection_result,GeometryN(in_polys,i));
    END LOOP;
    RETURN intersection_result;
END;
$$ LANGUAGE plpgsql;

----- Original Message ----
From: Curtis W. Ruck <ruckc at yahoo.com>
To: postgis-users at postgis.refractions.net
Sent: Wednesday, October 4, 2006 11:04:21 PM
Subject: [postgis-users] Aggregate Intersection?

Does anyone know of a way of chaining functions to do an aggregate intersection?  I have a table where i have multiple polygons and i need a intersection(geometry set) function.

Could i possibly write my own in plpgsql by getting the geometry set and looping through the polygons and more or less recursivly return Intersection(the_geom[3],Intersection(the_geom[2],Intersection(the_geom[0],the_geom[1])) ?

Curtis


_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061004/58394cd5/attachment.html>


More information about the postgis-users mailing list