[postgis-users] PostGIS topology behaviour with polygons
Sandro Santilli
strk at kbt.io
Wed Dec 7 06:41:36 PST 2022
On Wed, Dec 07, 2022 at 11:13:08AM +0100, Douglas Fan wrote:
> 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.
Expectance is wrong. It's expected for the resulting dataset to
contain gaps and overlaps. Having them in a topological model makes
it easier for you to spot them and fix them.
> 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.
Yes, order changes result because incoming geoms are snapped to
already-loaded ones. But snapping is only done against vertices,
not segments, so if you want to increas snapping you should densify
your geometries. Check out ST_Segmentize.
My suggestion though is to complete the data load process and
AFTERWARDS look for gaps/overlaps/slivers and process them.
--strk;
Libre GIS consultant/developer
https://strk.kbt.io/services.html
More information about the postgis-users
mailing list