[postgis-users] PostGIS topology behaviour with polygons

Douglas Fan douglas.mhfan at gmail.com
Wed Dec 7 02:13:08 PST 2022


Hi all,

Earlier I have asked a question about topology here
<https://gis.stackexchange.com/questions/446736/postgis-topology-result-still-has-gaps-and-overlap?noredirect=1#comment729180_446736>.
I still cannot understand the mechanism behind it so I hope that I may get
some help here.

I am trying to build topology on PostGIS with 4000+ polygons. The input are
not clean, with overlaps and gaps. I have created a procedure to commit
each update statement for each polygon so that I can catch the exception
and continue the process. The result still contain gaps and overlaps that
are smaller than the tolerance and expected to be snapped.

I have also tried to run toTopoGeom in the order of the number of vertices
of each polygon, with the idea that creating polygons with more vertices
may help the snapping process. It doesn't solve the problem and the number
of slivers is almost the same. However I have noticed that sequence of the
polygon to run toTopoGeom changes the result.

Use these 3 polygons as an example. When I create 3303 first, then 2451,
then 944, the gap cannot be cleaned. Yet when I create it in the reversed
order(944->2451->3303), the gap is gone. The gap is also gone when I run
toTopoGeom with only these 3 polygons together. (not one by one)

[image: test_withgap.png]

[image: test_withoutgap.png]

Does anyone have experience with this issue and may have an idea to explain
it? It seems to me an extra vertex on the horizontal edge of 3303 must be
provided so that the corner of 944 and 2451 can be snapped to it, but I
have not figured out a way to create such vertices for each T shape or ⊥
shape scenario.

Thank you for your time!

Regards,
Douglas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20221207/c942409d/attachment.htm>


More information about the postgis-users mailing list