[postgis-users] Advice on geometry collection to multipolygon approach

David Quinn daithiquinn at gmail.com
Mon Feb 18 04:15:21 PST 2013


Hi List,

What is the best way of converting a geometry collection to a multipolygon
in PostGIS 2.0? I have tried the following approach:

st_multi (
        st_union (
            st_intersection (
                st_buffer (t.point, radius), s.geom
            )
        )
    ) as geom

This results in the following error message:
"ERROR: Geometry type (GeometryCollection) does not match column type
(MultiPolygon) SQL state: 2202"
and I don't understand why I am getting this message. I've also seen
examples that use st_dump/st_collect using but am less sure if this returns
a multipolygon:

st_collect (
        st_dump (
            st_intersection (
                st_buffer (t.point, radius), s.geom
            )
        )
    ) as geom

Which approach should I use? My intersection query can return a single
geometry or a geometry collection.

Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130218/9e042266/attachment.html>


More information about the postgis-users mailing list