[postgis-users] Method to remove overlaps in a layer

Sandro Santilli strk at keybit.net
Wed Apr 11 12:38:08 PDT 2012


On Wed, Apr 11, 2012 at 09:26:45PM +0200, Sandro Santilli wrote:
> On Wed, Apr 11, 2012 at 02:53:07PM -0400, Pierre Racine wrote:
> > An even simpler example leads to another type of error:
> > 
> > SELECT CreateTopology('topo3',0, 10);
> > 
> > DROP TABLE IF EXISTS ovlp.test03;
> > CREATE TABLE ovlp.test03 AS
> > SELECT 1 id, ST_GeomFromText('POLYGON((0 1, 2 2, 2 0, 0 1))') geom
> > UNION ALL
> > SELECT 2 id, ST_GeomFromText('POLYGON((1 1, 3 2, 3 0, 1 1))') geom
> > 
> > CREATE TABLE ovlp.test03_topo (id integer);
> > 
> > SELECT AddTopoGeometryColumn('topo3', 'ovlp', 'test03_topo', 'topo', 'POLYGON'); -- 1
> > 
> > INSERT INTO ovlp.test03_topo (id, topo)
> > SELECT id, topology.toTopoGeom(geom, 'topo3', 1)
> > FROM ovlp.test03
> > 
> > gives:
> > 
> > ********** Error **********
> > 
> > ERROR: SQL/MM Spatial exception - edge crosses node.
> 
> Ouch, you're lucky. It kills the backend here !!
> I'm on it.

I've filed a ticket for the crash: 
http://trac.osgeo.org/postgis/ticket/1771

Note that everything works fine here with zero tolerance.
It's likely ST_Snap crashing the backend.
That snapper is really harmful...

Generally speaking though (manual page might need an update)
it doesn't make sense to tolerate 10 units and then input
geometries which do not fall on a 10 units grid.
If you use ST_SnapToGrid on the input those polygon
would become EMPTY (or points).

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list