Hello,

I'm having some trouble creating a 3D topology using totopogeom method, I don't 
know if I'm not using the functions correctly or if there's indeed a bug, so 
any help would be appreciated.

I reduced the problem to an example with two lines.
The first line is added with no errors to the topology but the second one 
throws this error "Corrupted topology: ring of edge -3 is geometrically 
not-closed".
The second line intersects with the first one, but there's no vertex on the 
intersection.
I found two workarounds but both of them have some disadvantages in my point of 
view.
The first one was to add manually a vertex on the intersection (this involves 
someone doing that work manually).
The other one was to add the start and end point of every line using 
topogeo_addpoint before calling totopogeom (this involves remembering to do 
this every time that I create a topology and I think it's redundant and 
overhead for most cases).

https://imgur.com/a/FgIVyMO - here is the visual of the data for the error and 
non-error approach
https://pastebin.com/CR5dNYSZ - here is a script to emulate the error, with the 
two workarounds commented

Not having much knowledge of the c code base, just looking at the code 
surrounding the error 
(https://www.postgis.net/docs/doxygen/3.0/d6/d03/lwgeom__topo_8c_source.html), 
my wild guess is that when it creates the ring of the newly closed area, and as 
there is no vertex on the intersection so no snap made, the ring is closed on 
2D dimension but there is a 3D gap that makes the ring not geometrically 
closed. My reasoning for this is that the same data with a 2D topology has no 
errors and if I reverse the insertion order (there would be a node on the 
intersection), it also works. I can also be completely wrong.

This error was tested on docker image postgis/postgis:14-3.2-alpine with 
postgis version:
POSTGIS="3.2.1 0" [EXTENSION] PGSQL="140" GEOS="3.10.2-CAPI-1.16.0" 
PROJ="8.2.0" LIBXML="2.9.13" LIBJSON="0.15" LIBPROTOBUF="1.4.0" WAGYU="0.5.0 
(Internal)" TOPOLOGY

There's no error in this version (also running in docker):
POSTGIS="3.0.1 ec2a9aa" [EXTENSION] PGSQL="120" GEOS="3.7.1-CAPI-1.11.1 
27a5e771" SFCGAL="1.3.6" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 
2.4.0, released 2018/12/14" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.3.1" 
WAGYU="0.4.3 (Internal)" TOPOLOGY RASTER

Thanks,
Alexandre Silva
​​​

[http://newsletter.impresapublishing.pt/i/barra_ip.jpg]
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to