[postgis-users] ST_Difference and ST_Buffer queries

Andrea Peri aperi2007 at gmail.com
Wed Sep 1 12:41:43 PDT 2010


Hi,

I'm not sure to understand your question.

But I think this query is quite good to clip all the polygons geometries of
a table with a single geometry.

SELECT
    ...
    CASE
        WHEN
            ST_GeometryType("geom")='ST_GeometryCollection'
        THEN
            ST_Multi(ST_CollectionExtract("geom", 3    ))
        ELSE
            ST_Multi("geom")
    END AS "geom"
FROM (
    SELECT
        ...
        ST_Intersection("geom", ST_GeomFromEWKB(decode('...', 'hex'))) AS
"geom"
        FROM
            "public"."table_to_clip"
        WHERE
            ST_Intersects("geom", ST_GeomFromEWKB(decode('...',
'hex')))=true
) AS t__0
WHERE
    ST_GeometryType("geom") IN ('ST_Polygon', 'ST_MultiPolygon',
'ST_GeometryCollection')



-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100901/e063f9be/attachment.html>


More information about the postgis-users mailing list