<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Strk and Nicolas,</p>
<p>Thanks for your replies.</p>
<p>I'm using GEOS 3.9, PostgreSQL 13.1 and Postgis 3.1 (self-compiled).</p>
<p>The situation is really weird: if I run the same SQL query a second time, the contradiction is gone and all geometries are labeled as invalid by ST_IsValidReason(). If I run it many times, the results change even more, suddenly, the invalid geometries are not even detected correctly by ST_IsValid().</p>
<p>@strk: these invalid geometries contain "NaN" coordinates.</p>
<p>I will open an issue and submit the geometries.</p>
<p>Andreas</p>
<p id="reply-intro">On 2020-12-23 15:40, Sandro Santilli wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">On Wed, Dec 23, 2020 at 11:20:07AM +0100, Andreas Neumann wrote:
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Hi,<br /><br />I have the strange situation that ST_IsValid() claims a geometry is not<br />valid, but then ST_IsValidReason() says 'Valid Geometry'<br /><br />Here is my query:<br /><br />SELECT<br />    t_id,<br />    ST_AsText(ST_MakeValid(geometrie)) AS geom_repaired,<br />    ST_AsText(geometrie) AS geom_orig,<br />    ST_IsValidReason(geometrie)<br />FROM arp_npl.erschlssngsplnung_erschliessung_linienobjekt<br />   WHERE ST_IsValid(geometrie) = False;<br /><br />And here parts of the output:<br />[image: image.png]<br /><br />Why is this contradiction - and which one is right? ST_IsValid() or<br />ST_IsValidReason() ?</blockquote>
<br />Sounds like a bug. ST_IsValid should print the invalidity in a NOTICE,<br />it looks like ST_IsValidReason is failing to check that kind of<br />invalidity. Would be useful to file a ticket and attach the offending<br />geometry (best if reduced as much as possible).<br /><br />--strk;<br />_______________________________________________<br />postgis-users mailing list<br /><a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br /><a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></div>
</blockquote>
<p><br /></p>

</body></html>