[postgis-users] Topology: cannot delete slivers (or gaps)

Sandro Santilli strk at keybit.net
Fri Oct 31 13:54:42 PDT 2014


On Fri, Oct 31, 2014 at 12:19:31PM -0700, Guillaume Drolet wrote:
> Hi Sandro,
> 
> Thanks for your help!
> 
> topology.ValidateTopology gives this:
> 
> error                                  id1               id2
> character varying                 integer         integer
> ------------------               -----------   ----------------
> face has no rings                 1831
>
> If I calculate the area of face 1831
> (st_area(st_getfacegeometry('de_20k_topo', face_id))), I get a NULL value.

I suggest you take a look at edges having face 1831 on either
the right or left edge. Do any edge exist ? 

> I also find I have some 650 of these slivers with an area below 75 m2 while
> most of my correct polygons have an area above 300 000 000 m2.

The correct procedure to drop those slivers would be to assign
those small areas to the (closest|biggest|leftmost|youpickit)
TopoGeometry object, to one and only one, and then, if you really
need it, drop the edge internal to the TopoGeometry.

I made a QGIS plugin which may help you do some of these things
manually, which is useful in some cases, mainly to understand the
issues.

> Re the edges passed to ST_NewEdgeHeal, in the example I sent it was edges
> 3908 and 3909.

So the error was right about there being another edge attached to the node:

 ERROR:  SQL/MM Spatial exception - other edges connected (3912)

I'm guessing 3912 and 3908 are the two parallel edges in the picture
you attached: https://dl.dropboxusercontent.com/u/5196336/example1.bmp

Again, QGIS may help you getting more info out of the visual, enable
the DBManager core plugin, select your topology schema and select
Schema->TopoViewer from the menu.

> PS. Forgot to mention that in the first topology I had created, I used a
> tolerance of 2.0 meters instead of 1e-4 meters. While that yielded much less
> slivers, I was getting way more of those nodes not located at an
> intersection. What is best?

It's probably easier to clean up nodes for an areal topology than to
clean up faces. With my QGIS plugin (PostGIS Topology Editor) you can
select all nodes and click on a button which will drop all the ones
that are safe to drop.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the postgis-users mailing list