[postgis-users] ST_Difference (again)

Obe, Regina robe.dnd at cityofboston.gov
Mon May 12 04:24:41 PDT 2008


Dylan,

What is your real SQL statement :)  The below shouldn't even run e.g.
you can't group by a table and you have to group by your difference
since that is not an aggregate. Also I think you should be subtracting
your non-buffered from your buffered if you want the doughnut left by
your buffer.

I would expect your query to look like this

SELECT A.country_name, ST_Difference(B.buffered_geom,
A.buffered_geom) As diff_geom
FROM  A INNER JOIN B ON A.country_name = B.country_name


Is your A geom really called buffered_geom too?

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Dylan Lorimer
Sent: Sunday, May 11, 2008 9:57 PM
To: PostGIS Users Discussion
Subject: [postgis-users] ST_Difference (again)

Hi All,

So just as I thought I understood ST_Difference, I'm again confounded
with some bizarre behaviour I can't figure out.

I have a bunch of polygons all over the world that I've successfully
grouped by country name. So for example, in India I have a single
geometry that is a multipolygon, that consists of probably around 3000
random shaped polys in India. That is table A.

I took those polygons and buffered them all by some amount. This
produced...buffered polygons, as expected. That is table B.

What I want to do now is remove the original polygons from the
buffered poygons, and keep everything grouped by country, thereby
leaving me the bit that I buffered by without the original.
ST_Difference...right?

Here's what I tried:

SELECT A. country_name, ST_Difference(A.buffered_geom,
B.buffered_geom) from A,B GROUP by A;

What I get as the return value is A. Nothing more, nothing less.

Any ideas?
Cheers,
dylan
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
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.




More information about the postgis-users mailing list