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

Andreas Neumann a.neumann at carto.net
Wed Dec 23 07:51:07 PST 2020


Hi Strk and Nicolas, 

Thanks for your replies. 

I'm using GEOS 3.9, PostgreSQL 13.1 and Postgis 3.1 (self-compiled). 

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(). 

@strk: these invalid geometries contain "NaN" coordinates. 

I will open an issue and submit the geometries. 

Andreas 

On 2020-12-23 15:40, Sandro Santilli wrote:

> On Wed, Dec 23, 2020 at 11:20:07AM +0100, Andreas Neumann wrote: 
> 
>> 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() ?
> 
> Sounds like a bug. ST_IsValid should print the invalidity in a NOTICE,
> it looks like ST_IsValidReason is failing to check that kind of
> invalidity. Would be useful to file a ticket and attach the offending
> geometry (best if reduced as much as possible).
> 
> --strk;
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20201223/cd48e760/attachment.html>


More information about the postgis-users mailing list