[postgis-users] Function OVERLAPS() versus &&

Markus Schaber schabios at logi-track.com
Thu Jan 20 01:29:28 PST 2005


Hi, James,

James G Wilkinson schrieb:

> Okay, so here is what I really want.  I want a query that will return all
> the polygons in US_POPHU plus those new polygons that result from
> overlapping polygons from US_POPHU and US_TRIBES.  I have tried
> using LEFT JOIN without success, as in the following example:
>
> CREATE TALBE us_pophu_prj AS
>     SELECT a.gid, b.gid AS sec_gid, GEOMUNION(a.the_geom,b.the_geom)
>     FROM us_pophu a
>     LEFT JOIN us_tribes b
>     ON a.gid >= b.gid OR a.gid <= b.gid     WHERE a.the_geom && b.the_geom;
>
> Any help that can prevent me from further knocking my head against the wall
> will most certainly be appreciated.

Do you realize that your ON clause actually will be true on every pair
of rows?

What is the exact condition that allows two geoms to be combined?

Maybe you should divide your query into two parts, and concatenate the
results with UNION. First gett all geometries from a, and then UNION
with a query that produces all the GeomUnions.

Markus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050120/d496f9e5/attachment.pgp>


More information about the postgis-users mailing list