I think you are getting the collection because you are mixing types.
Try this (I haven't tried it):

st_collect(
  st_collect(st_multi(polygon1), st_multi(polygon2)),
  st_multi(polygon3))

and see if you get a multipolygon ot a collection as the result.

-Steve W

Düster Horst wrote:

Regina
Thank you for your response. Mmmm.. your trick doesn't solve my problem. Perhaps I should tell you why I do have a geometrycollection. My startingpoint is a sequence of single polygons. My aim is to merge them together to one multipolygon. I do this with st_collect. This works fine with two polygons: st_collect(polygon1,polygon2) => multipolygon(1,2). When I Process the third polygon with: st_collect(multipolygon(1,2), polygon3) => Geometrycollection(multipolygon(1,2),polygon3) I do get the geomtrycollection and so on. My main problem is to merge the three polygons into one multipolygon with 3 geometries. When I solve this problem I can offer a procedure to clean invalid geometries. Regards
Horst
------------------------------------------------

Dr. Horst Düster
GIS-Koordinator, Stv. Amtschef

Kanton Solothurn
Bau- und Justizdepartement
Amt für Geoinformation
SO!GIS Koordination
Rötistrasse 4
CH-4501 Solothurn

Telefon ++41(0)32 627 25 32
Telefax ++41(0)32 627 22 14

mailto:[EMAIL PROTECTED]
http://www.agi.so.ch <http://www.agi.so.ch/>

    -----Ursprüngliche Nachricht-----
    *Von:* Obe, Regina [mailto:[EMAIL PROTECTED]
    *Gesendet am:* Mittwoch, 23. April 2008 14:24
    *An:* PostGIS Users Discussion
    *Betreff:* RE: [postgis-users] Geometrycollection to Multipolygon

    This sometimes does the trick for me if they actually can be unioned
ST_Union(GEOMCOLL, ST_GeomFromText('GEOMETRYCOLLECTION(EMPTY)',
    yoursridhere) )
(your number 2 doesn't work because that is the aggregate form, not
    because ST_Union can't handle geometry collections I think)
Hope that helps,
    Regina
       *From:* [EMAIL PROTECTED]
    [mailto:[EMAIL PROTECTED] *On Behalf Of
    *Düster Horst
    *Sent:* Wednesday, April 23, 2008 2:25 AM
    *To:* postgis-users
    *Subject:* [postgis-users] Geometrycollection to Multipolygon

    I do have a Geometrycollection which consists of a collection of
    Multipolygons and Polygons. My aim is to create one single
    Multipolygon from the mentioned Geometry collection.

    Until now I tried the following steps without result:

    1. ST_BUFFER(GEOMCOLL,0.0) => It works but all inner rings of my
    input geometry are lost.
    2. ST_UNION(GEOMCOLL) => doesn't work with Geometrycollections

    Does anyone has a solution to solve my problem?

    Best regards
    Horst

    ------------------------------------------------

    Dr. Horst Düster
    GIS-Koordinator, Stv. Amtschef

    Kanton Solothurn
    Bau- und Justizdepartement
    Amt für Geoinformation
    SO!GIS Koordination
    Rötistrasse 4
    CH-4501 Solothurn

    Telefon ++41(0)32 627 25 32
    Telefax ++41(0)32 627 22 14

    mailto:[EMAIL PROTECTED]
    http://www.agi.so.ch

    *The substance of this message, including any attachments, may be
    confidential, legally privileged and/or exempt from disclosure
    pursuant to Massachusetts law. It is intended solely for the
    addressee. If you received this in error, please contact the sender
    and delete the material from any computer. *

    * Help make the earth a greener place. If at all possible resist
    printing this email and join us in saving paper. *

    * *


------------------------------------------------------------------------

_______________________________________________
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