[postgis-users] GEOSUnaryUnion: TopologyException: found non-noded intersection BUT geom is valid

Birgit Laggner birgit.laggner at thuenen.de
Wed Sep 19 00:47:41 PDT 2018


Dear Darafei, 

good idea to write a wrapper to ferret out the offending rows. I had to change it a bit because I don't use ST_Union(geometry, geometry) but the aggregate ST_Union(geometry). Since I am not very experienced in writing aggregates, I modified the wrapper that it fits for ST_Union(geometry[]) and used it in my query with ST_Union_Fails(array_agg(geom)). 

I have found 3 groups with a total of 923 geometries which returned an error with ST_Union. 

As soon as I get access to my old userID, I will file the them as a ticket. 

In the meantime I will try to union the problematic geometries in a loop one at a time with st_makevalid after each loop - maybe that will work as a workaround, now I could reduce the number of geometries dramatically. 


Thank you very much for your help! 

Kind regards, 
Birgit 




Von: "Darafei \"Komяpa\" Praliaskouski" <me at komzpa.net> 
An: "PostGIS Users Discussion" <postgis-users at lists.osgeo.org> 
Gesendet: Mittwoch, 19. September 2018 02:46:42 
Betreff: Re: [postgis-users] GEOSUnaryUnion: TopologyException: found non-noded intersection BUT geom is valid 

Hi, 
This is not supposed to happen. 

Can you please isolate the offending rows unioning them pairwise and file them as a ticket? Here's a handy helper function that returns True if Union failed: 

create or replace function st_union_fails (geom1 geometry , geom2 geometry ) 
returns boolean 
as $$ 
begin 
begin 
geom1 = ST_Union (Geom1 , geom2) ; 
return false ; 
exception when others 
then 
return true ; 
end ; 
end ; 
$$ 
language plpgsql ; 



вт, 18 сент. 2018 г. в 16:25, Birgit Laggner < [ mailto:birgit.laggner at thuenen.de | birgit.laggner at thuenen.de ] >: 



Dear discussion group, 

I am trying to ST_Union several polygons and get a TopologyException (GEOSUnaryUnion: TopologyException: found non-noded intersection between LINESTRING (3.56442e+06 5.42679e+06, 3.56442e+06 5.42679e+06) and LINESTRING (3.56442e+06 5.42679e+06, 3.56442e+06 5.42679e+06) at 3564420.7944701263 5426786.9800475985). 
I have tested with ST_Valid and all polygons in the datasets are valid. 

The dataset is pretty large (53.5 Mio. polygons) and will probably get grouped into around 8.7 Mio resulting geometries during ST_Union. 

If I try to ST_Union the geometries near the point ST_Union mentions in the error message (ST_Buffer with up to 100 metres), everything works fine. I am out of ideas how to find the problematic geometry or at least how to work around the TopologyException. 

My PostGIS version is: "POSTGIS="2.3.3 r15473" GEOS="3.5.1-CAPI-1.9.1 r4246" SFCGAL="1.2.2" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.3, released 2015/09/16" LIBXML="2.9.3" LIBJSON="0.11.99" TOPOLOGY RASTER" 


I would be very glad if anyone would come up with ideas how to solve my problem. 

Thanks a lot in advance! 

Regards, 
Birgit 


_______________________________________________ 
postgis-users mailing list 
[ mailto:postgis-users at lists.osgeo.org | postgis-users at lists.osgeo.org ] 
[ https://lists.osgeo.org/mailman/listinfo/postgis-users | https://lists.osgeo.org/mailman/listinfo/postgis-users ] 



-- 
Darafei Praliaskouski 
Support me: [ http://patreon.com/komzpa | http://patreon.com/komzpa ] 

_______________________________________________ 
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/20180919/df3b79da/attachment.html>


More information about the postgis-users mailing list