[postgis-users] Geomunion

Obe, Regina robe.dnd at cityofboston.gov
Thu Aug 30 05:13:30 PDT 2007


SELECT geomunion(the_geom) as newgeom
FROM sometable
 
Depending on how large your geometries are or whether they are valid,
this may throw an error or be really really slow.
 
You may need to do 
 
SELECT geomunion(the_geom) as newgeom
FROM sometable
WHERE isvalid(the_geom) = true
 
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. 
 
 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.
 
SELECT buffer(collect(the_geom),0.0) as newgeom
FROM sometable
 
(If you are using Postgis 1.3.1 and above use st_union, st_collect,
st_isvalid instead)
 
Hope that helps,
Regina
 
 
 
 

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Thorsten Kraus
Sent: Thursday, August 30, 2007 6:54 AM
To: PostGisMailingList (E-Mail)
Subject: [postgis-users] Geomunion



Hello, 

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?

Regards, 
Thorsten 




-----------------------------------------
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070830/f8cd5721/attachment.html>


More information about the postgis-users mailing list