[postgis-users] Contradiction between ST_IsValid() and ST_IsValidReason() ?

Andreas Neumann andreas at qgis.org
Wed Dec 23 02:20:07 PST 2020


Hi,

I have the strange situation that ST_IsValid() claims a geometry is not
valid, but then ST_IsValidReason() says 'Valid Geometry'

Here is my query:

SELECT
    t_id,
    ST_AsText(ST_MakeValid(geometrie)) AS geom_repaired,
    ST_AsText(geometrie) AS geom_orig,
    ST_IsValidReason(geometrie)
FROM arp_npl.erschlssngsplnung_erschliessung_linienobjekt
   WHERE ST_IsValid(geometrie) = False;

And here parts of the output:
[image: image.png]

Why is this contradiction - and which one is right? ST_IsValid() or
ST_IsValidReason() ?

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.

Any ideas? I could of course share these strange geometries.

Thanks,

Andreas
--
Andreas Neumann
QGIS.ORG board member (treasurer)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20201223/6dd1ee52/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 80688 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20201223/6dd1ee52/attachment.png>


More information about the postgis-users mailing list