[postgis-users] Counting intersecting polygons

Sarthak Vijay sarthak at attentive.ai
Mon May 27 03:57:08 PDT 2019


Hi All,
I have 2 tables containing polygons in same general area. What I want is
the count of polygons in the first table (Table_1, represented by purple)
that intersect with polygons in the 2nd (Table_2, represented by green).
[image: Screenshot from 2019-05-23 13-33-24.png]
For the above example, I want the output as 1. I have tried -
SELECT COUNT(*) FROM Table_1,Table_2 WHERE
ST_Intersects(Table_1.wkb_geometry,Table_2.wkb_geometry);

This command returns the answer 3 which doesn't work for me.
Could someone please suggest relevant command.
Thanks in advance.

Regards,
Sarthak Vijay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190527/13975be6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2019-05-23 13-33-24.png
Type: image/png
Size: 10149 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190527/13975be6/attachment.png>


More information about the postgis-users mailing list