<div dir="ltr"><div>Hi David,</div><div><br></div><div>You can use st_isValidReason(geom) to inspect an invalid geometry.</div><div>Predicates like st_contains, st_overlaps, st_intersects, etc. can give you information about relationship between geometries. They all originate from st_relate (<a href="http://postgis.net/docs/ST_Relate.html">http://postgis.net/docs/ST_Relate.html</a>)</div><div><br></div><div>Nicolas<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 1 Dec 2021 at 12:29, Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com">shishaozhong@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>This is interesting.</div><div><br></div><div>Can we have an SQL to produce report on the status of polygon?  Namely, can we write a script to tell us whether a geometry is a valid single geometry, or polygons inside polygon, whether there be any issues such as self-intersect in a polygon?</div><div><br></div><div>SQL reporting on geometry is of interest.</div><div><br></div><div>Is it possible to send me a small file of polygons inside polygon in a format of CSV or Well Known Text, so that I can test out and confirm the robustness of SQL scripts?</div><div><br></div><div>Regards,</div><div><br></div><div>David</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 30 Nov 2021 at 06:30, <<a href="mailto:paul.malm@lfv.se" target="_blank">paul.malm@lfv.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="SV">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I have a polygon layer where polygons are inside other polygons (could be polygons in polygons in polygons…).
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I would like to separate them in 2 different layers, one layer with the outer most polygon and one layer with all polygons that has a surrounding polygon.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Is there a smart way to do this in SQL?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Paul<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">    </span>
<span><img style="width: 1.375in; height: 1.1145in;" id="gmail-m_1217399230155289585gmail-m_-3801678493604947127Bild_x0020_1" src="cid:17d75bb8b724ce8e91" alt="1_LFV_svensk_96" width="132" height="107"><u></u><u></u></span></p>
<table style="width:630pt;border-collapse:collapse" width="0" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="height:36.85pt">
<td style="width:315pt;padding:0cm;height:36.85pt" width="420" valign="top">
<p class="MsoNormal" style="margin-top:2pt;line-height:10pt">
<span style="font-size:9pt;color:rgb(51,51,51)">  </span><span style="font-size:9pt">Paul Malm<span style="color:rgb(51,51,51)"><u></u><u></u></span></span></p>
<p class="MsoNormal" style="margin-top:2pt;line-height:10pt">
<span style="font-size:9pt;color:rgb(51,51,51)"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-top:2pt;line-height:10pt">
<span style="font-size:9pt;color:rgb(51,51,51)">  Operations / AIM Flyginfo SE</span><span style="font-size:9pt;color:rgb(51,51,51)"><u></u><u></u></span></p>
</td>
<td style="width:315pt;padding:0cm 0cm 0cm 2.25pt;height:36.85pt" width="420" valign="top">
<p class="MsoNormal" style="margin-top:2pt;line-height:10pt">
<span style="font-size:9pt;color:rgb(51,51,51)"><u></u> <u></u></span></p>
</td>
</tr>
<tr style="height:24.1pt">
<td style="width:315pt;padding:0cm;height:24.1pt" width="420" valign="top">
<p class="MsoNormal" style="margin-bottom:12pt;line-height:9pt">
<span style="font-size:9pt;color:rgb(51,51,51)">  Direkt  08-797 70 23  Mobil 07</span><span style="font-size:9pt">0<span style="color:rgb(51,51,51)">-860 11 15<br>
  <a href="mailto:paul.malm@lfv.se" target="_blank">paul.malm@lfv.se</a>  <u></u><u></u></span></span></p>
<p class="MsoNormal" style="line-height:9pt"><span style="font-size:9pt;color:rgb(51,51,51)">   Besöks- och postadress<br>
   LFV Flyginfo SE<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:9pt"><span style="font-size:9pt;color:rgb(51,51,51)">   Af Pontins väg 6
<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:9pt"><span style="font-size:9pt;color:rgb(51,51,51)">   115 21 STOCKHOLM<u></u><u></u></span></p>
</td>
<td style="width:315pt;padding:0cm 0cm 0cm 2.25pt;height:24.1pt" width="420" valign="top">
<p class="MsoNormal" style="line-height:9pt"><span style="font-size:9pt;color:rgb(51,51,51)"><u></u> <u></u></span></p>
</td>
</tr>
<tr>
<td style="width:315pt;padding:0cm" width="420" valign="top">
<p class="MsoNormal" style="margin-bottom:12pt;line-height:9pt">
<span style="font-size:9pt;color:rgb(51,51,51)">  <u></u><u></u></span></p>
</td>
<td style="width:315pt;padding:0cm 0cm 0cm 2.25pt" width="420" valign="top">
<p class="MsoNormal" style="margin-top:2pt;line-height:9pt">
<span style="font-size:9pt;color:rgb(51,51,51)"><u></u> <u></u></span></p>
</td>
</tr>
<tr style="height:3.7pt">
<td style="width:315pt;padding:0cm;height:3.7pt" width="420" valign="top">
<p class="MsoNormal" style="margin-top:6pt;line-height:9pt">
<span style="font-size:9pt;color:rgb(0,204,0)">   Tänk på miljön innan du skriver ut detta e-postmeddelande.</span><span style="font-size:9pt;color:rgb(0,204,0)"><u></u><u></u></span></p>
</td>
<td style="width:315pt;padding:0cm 0cm 0cm 2.25pt;height:3.7pt" width="420" valign="top">
<p class="MsoNormal" style="margin-top:6pt;line-height:9pt">
<span style="font-size:9pt;color:rgb(0,204,0)"><u></u> <u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
</blockquote></div></div>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
</blockquote></div>