[postgis-users] polygons inside polygon
Nicolas Ribot
nicolas.ribot at gmail.com
Tue Nov 30 10:16:47 PST 2021
Hi,
What about a simple left join on the table searching for polygons contained
inside other polygon ?
Polygons that are contained inside other polygons will have false for the
outer_pg column and true if they are not contained (ie are outer polygons).
You can then create the tables you want based on the outer_pg values
select distinct p1.id, p2.id is null as outer_pg
from polygon p1
left join polygon p2 on p1.id <> p2.id and st_within(p1.geom, p2.geom)
order by p1.id;
id outer_pg
1 true
2 true
3 true
4 true
5 false
6 false
7 false
8 true
9 true
10 true
11 false
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20211130/169d6ed7/attachment.html>
More information about the postgis-users
mailing list