[postgis-users] Re: ST_Difference Perplexes Me!

Obe, Regina robe.dnd at cityofboston.gov
Tue May 6 05:35:05 PDT 2008


Dylan,
 
So are you saying that with ST_Union you got topological intersection
errors but with ST_MemUnion you didn't?  This would be very intriguing
if that were the case
since in theory both should yield the same result albeit slightly
differently.
 
ST_Union does an array collect and then unions where as ST_MemUnion
keeps on unioning 2 geometries at a time.
 
Thanks,
Regina

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Dylan Lorimer
Sent: Monday, May 05, 2008 9:47 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Re: ST_Difference Perplexes Me!


Wanted to follow-up on this with the SQL that worked in the end.
Firstly...thanks so much Regina! I've no confidence that I ever would
have figured out this sql on my own, and yet looking at it now it makes
perfect sense!

So here it is in case anyone else is interested:

- vmap_countries contains country boundaries
- published_both_prototype_union contains dissolved polygons all over
the world (millions of them.)

CREATE TABLE not_meter_or_less_prototype AS 
SELECT ST_Difference(vmap_countries.the_geom, C.the_sum_geom),
vmap_countries.country_na
FROM vmap_countries INNER JOIN (SELECT
ST_MemUnion(published_both_prototype_union.the_geom) As the_sum_geom,
vmap_countries.country_na
   FROM vmap_countries INNER JOIN published_both_prototype_union ON
ST_Intersects(vmap_countries.the_geom,
published_both_prototype_union.the_geom)
               WHERE vmap_countries.country_na IN ('China', 'India',
'Japan')
               GROUP BY vmap_countries.country_na ) As C
ON  vmap_countries.country_na = C.country_na;

Many many (many) thanks to those on the list that have helped me out!
Cheers,
dylan



-----------------------------------------
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/20080506/5fe6b8db/attachment.html>


More information about the postgis-users mailing list