AW: AW: [postgis-users] Overlaps query
Thorsten Kraus
Thorsten.Kraus at ptv.de
Fri May 25 01:21:54 PDT 2007
Thanks, that works even better. The execution time reduced to 17946 ms.
Bye,
Thorsten
-----Ursprüngliche Nachricht-----
Von: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net]
Gesendet: Freitag, 25. Mai 2007 10:14
An: PostGIS Users Discussion
Betreff: Re: AW: [postgis-users] Overlaps query
Thorsten Kraus wrote:
>
> Thanks for your answer. I have tried this before.
>
> SELECT COUNT(a.id) FROM tbl1 a, tbl1 b WHERE a.geom && b.geom and a.id
> <> b.id
>
> But the result differs from my other query. Regarding to the PostGIS
> doc at http://postgis.refractions.net/docs/ch06.html the && operator
> does not check the spatial overlap of two geometries, it checks if the
> bounding boxes of thw geometries overlap. But in my case I need to
> check if two geometries spatially overlap. Perhaps there is a
> possibility to make this faster in some way.
>
Try combing the two together - Postgis can use the spatial index to find
the overlapping bounding boxes, then use the overlaps function to do an
exact check.
SELECT COUNT(a.id)
FROM tbl1 a, tbl1 b
WHERE a.geom && b.geom
AND a.id <> b.id
AND OVERLAPS(a.geom, b.geom)
Rob :)
--
One Track Mind Ltd.
PO Box 1604, Shortland St, Auckland, New Zealand
Phone +64-9-966 0433 Mobile +64-21-572 632
Web http://www.onetrackmind.co.nz
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070525/6c79e16f/attachment.html>
More information about the postgis-users
mailing list