Yes, it appears the bug is that that assumption is not being fulfilled. A bug 
ticket is already submitted.

Thanks for your response,
Alexandre






________________________________
De: postgis-users <[email protected]> em nome de Regina Obe 
<[email protected]>
Enviado: 29 de agosto de 2022 22:29
Para: 'PostGIS Users Discussion' <[email protected]>
Assunto: Re: [postgis-users] Corrupted topology when using totopogeom in 3D 
topology


I think the issue is that postgis topology only works with 2D and simply just 
carries the Z.  So all its assumptions about closedness and intersection are 
based on the 2D plane.



Thanks,

Regina



From: postgis-users [mailto:[email protected]] On Behalf Of 
Alexandre Silva
Sent: Friday, August 26, 2022 7:14 AM
To: [email protected]
Subject: [postgis-users] Corrupted topology when using totopogeom in 3D topology



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<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimgur.com%2Fa%2FFgIVyMO&data=05%7C01%7Camsilva%40infoportugal.impresa.pt%7C1526482a021843c6b13c08da8a058db7%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637974053710375944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D09MApc56bQEbE2wWq0NW2q9BppcOMmfVdrdo%2B1%2FrtU%3D&reserved=0>
 - here is the visual of the data for the error and non-error approach

https://pastebin.com/CR5dNYSZ<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpastebin.com%2FCR5dNYSZ&data=05%7C01%7Camsilva%40infoportugal.impresa.pt%7C1526482a021843c6b13c08da8a058db7%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637974053710375944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zknaJJU%2FbS88WmkQE1g3X6EhbEb7d10tDxhkjnJR%2Fjs%3D&reserved=0>
 - 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<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgis.net%2Fdocs%2Fdoxygen%2F3.0%2Fd6%2Fd03%2Flwgeom__topo_8c_source.html&data=05%7C01%7Camsilva%40infoportugal.impresa.pt%7C1526482a021843c6b13c08da8a058db7%7Cd227b2e71c404f63b5132f3665c334e6%7C0%7C0%7C637974053710375944%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eJbKR60%2FI2cu%2FL3yR8zlsBp4UvGSYXe%2F2%2B6MzxFLfaE%3D&reserved=0>),
 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
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to