<div dir="ltr"><div>Hello</div><div><br></div><div>What is Postgis/geos version ?</div><div>Yes, one or two examples of these strange geometries would be nice.</div><div><br></div><div>Nicolas<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 23 Dec 2020 at 11:20, Andreas Neumann <<a href="mailto:andreas@qgis.org">andreas@qgis.org</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 dir="ltr"><div dir="ltr"><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Hi,</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">I have the strange situation that ST_IsValid() claims a geometry is not valid, but then ST_IsValidReason() says 'Valid Geometry'</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Here is my query:</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-family:monospace">SELECT<br style="box-sizing:border-box">    t_id,<br style="box-sizing:border-box">    ST_AsText(ST_MakeValid(geometrie)) AS geom_repaired,<br style="box-sizing:border-box">    ST_AsText(geometrie) AS geom_orig,<br style="box-sizing:border-box">    ST_IsValidReason(geometrie)<br style="box-sizing:border-box">FROM arp_npl.erschlssngsplnung_erschliessung_linienobjekt <br style="box-sizing:border-box">   WHERE ST_IsValid(geometrie) = False;</span></p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">And here parts of the output:</p><img src="cid:ii_kj19lgrr0" alt="image.png" width="546" height="109"><br><br><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"></p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Why is this contradiction - and which one is right? ST_IsValid() or ST_IsValidReason() ?</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">I had a quick look at the geometries in question and they are all LINESTRING geometries with a "loop". Visually it is not clear whether the LINESTRING is crossing itself or not.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Any ideas? I could of course share these strange geometries.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Thanks,</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:1rem;color:rgb(79,79,79);font-family:Verdana,Geneva,sans-serif;font-size:13.3333px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Andreas</p><div dir="ltr"><div dir="ltr"><div>--<br>Andreas Neumann<br></div><a href="http://QGIS.ORG" target="_blank">QGIS.ORG</a> board member (treasurer)<br></div></div></div></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>