<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Geomunion</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>SELECT geomunion(the_geom) as 
newgeom</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>FROM sometable</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>Depending on how large your geometries are or whether they 
are valid, this may throw an error or be really really slow.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>You may need to do </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>SELECT geomunion(the_geom) as newgeom</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>FROM sometable</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>WHERE isvalid(the_geom) = true</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>Depending on what you need this for, you may want to 
consider using COLLECT instead of geomunion which tends to be a lot faster and 
more forgiving of invalid geometries. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2> I think Martin Davis had suggested something like the 
below a week or so back as a faster alternative to geomunion - I 
haven't actually compared the differences in output between the 2 approaches to 
know the downsides.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>SELECT buffer(collect(the_geom),0.0) as 
newgeom</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>FROM sometable</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>(If you are using Postgis 1.3.1 and above use st_union, 
st_collect, st_isvalid instead)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=970442511-30082007></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
</B>Thorsten Kraus<BR><B>Sent:</B> Thursday, August 30, 2007 6:54 
AM<BR><B>To:</B> PostGisMailingList (E-Mail)<BR><B>Subject:</B> [postgis-users] 
Geomunion<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<P><FONT face=Arial size=2>Hello,</FONT> </P>
<P><FONT face=Arial size=2>I want to union all geometries of a table into one 
big geometry. Do you know how this task can be performed the best 
way?</FONT></P>
<P><FONT face=Arial size=2>Regards,</FONT> <BR><FONT face=Arial 
size=2>Thorsten</FONT> </P></BODY></HTML>

<HTML><BODY><P><hr size=1></P>
<P><STRONG>
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.
</STRONG></P></BODY></HTML>