[postgis-users] Problems with GeomUnion

Bill Binko bill at binko.net
Fri Apr 8 14:57:31 PDT 2005


On Fri, 8 Apr 2005 strk at refractions.net wrote:

> On Fri, Apr 08, 2005 at 11:08:59AM -0400, Bill Binko wrote:
> > On Thu, 7 Apr 2005, Martin Davis wrote:
> > 
> > > > Now I need a way to fix self-intersecting shapes.  
> > > 
> > > If you do a buffer(0) on the shapes as you load them (or after you load
> > > them), that will convert them to valid geometry while preserving their
> > > outline.
> > > 
> > 
> > I'm having some issues with that solution (and I was very excited to hear 
> > such a simple one!).  When I run this:
> > 
> > update parcels set parcel_shape = buffer(parcel_shape, 0);
> > 
> > I get:
> > 
> > ERROR:  new row for relation "parcels" violates check constraint "enforce_geotype_parcelShape"
> 
> What version of postgis/geos are you running ?
> Could you provide an .sql file containing the 2d geometry that
> fed to buffer(0) becomes a non-2d one ? 
> --strk;

select postgis_full_version() reads:

 POSTGIS="1.0.0RC6" GEOS="2.1.1" PROJ="Rel. 4.4.7, 31 March 2003"
USE_STATS DBPROC="0.3.0" RELPROC="0.3.0"

I've put a dump of all of the offensive shapes at 
http://www.binko.net/dump.gz However, I cannot tell which are causing the 
failures, since the buffer() calls never complete and the transaction 
rolls back.

I'm open to suggestions on narrowing those down.

Bill