[postgis-users] ST_Unioning invalid multipolygons

David Jantzen david at culturemob.com
Fri Aug 29 11:39:26 PDT 2008


Thanks for the suggestion.  I managed to get a workable result by using
ST_SimplifyPreserveTopology, like so:

ST_Multi(ST_Union(ST_SimplifyPreserveTopology(n.the_geom, 0.001)))

Any red flags about this approach?

Thanks,
David

On Fri, 2008-08-29 at 09:01 -0400, Burgholzer,Robert wrote:
> http://www.sogis1.so.ch/sogis/dl/postgis/cleanGeometry.sql 
> 
> you need caps on the "G" in geometry.
> 
> Robert W. Burgholzer
> Surface Water Modeler
> Office of Water Supply and Planning
> Virginia Department of Environmental Quality
> rwburgholzer at deq.virginia.gov
> 804-698-4405
> Open Source Modeling Tools:
> http://sourceforge.net/projects/npsource/
> 
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Stephan Holl
> Sent: Friday, August 29, 2008 4:35 AM
> To: PostGIS Users Discussion
> Cc: Horst.Duester at bd.so.ch
> Subject: Re: [postgis-users] ST_Unioning invalid multipolygons
> 
> Hello Horst,
> 
> Düster Horst <Horst.Duester at bd.so.ch>, [20080829-09:02:02]:
> 
> > Mmmmm...
> > >Another solution which *may* work is to replace the geometry by a
> > buffer 
> > >of size 0 around the geometry in your select statement 
> > 
> > No this is a bad idea. You do not have any control about the result of
> > your buffer(0). A better way is to clean the polygon geometry with the
> > cleangeometry() function you can download from:
> > 
> > http://www.sogis1.so.ch/sogis/dl/postgis/cleangeometry.sql
> 
> This link seems to be wrong, I get a 404.
> Could you post the correct link to this interesting-sounding
> function, please?
> 
> > The function cleans by breaking the self-intersecting parts of your
> > geometry into multigeometries.
> > 
> > Sometimes postgis throws topology exeptions although your geometry is
> > valid. In this case geos by itself produces the error. Maybe this is
> > the result of rounding problems and you don't have any chance to
> > solve the problem.
> 
> best regards from Osna
> 
> 	Stephan
> 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Michael Michaud [mailto:michael.michaud at free.fr]
> > Gesendet am: Freitag, 29. August 2008 08:24
> > An: PostGIS Users Discussion
> > Betreff: Re: [postgis-users] ST_Unioning invalid multipolygons
> > 
> > David Jantzen a écrit :
> > > Hi again,
> > >
> > > I'm trying to ST_Union multipolygons from the Zillow neighborhood
> > data.
> > > When I do this I occasionally see:
> > >
> > > NOTICE:  TopologyException: found non-noded intersection between
> > > -73.812....
> > >
> > > This appears to be due to invalid geometries, as the following query
> > > returns over a hundred rows:
> > >
> > > select * from neighborhoods where not ST_IsValid(the_geom)
> > >
> > > Can anyone suggest a workaround here?  The resulting geometry needs
> > > to be a multipolygon.  Also, what is ST_Is_valid actually testing
> > > for?
> > The
> > > documentation isn't very explicity about the definition of validity.
> > >   
> > Most of time, invalid polygons are polygons with a self intersecting 
> > boundaries (as in the number '8') or self-touching boundary (two non 
> > contiguous points of the boundary are touching each other)
> > The best solution is to correct those geometries if you can.
> > Another solution which *may* work is to replace the geometry by a
> > buffer
> > 
> > of size 0 around the geometry in your select statement (using a
> > 0-buffer
> > 
> > is a work-around which generally works with JTS library from which 
> > postgis functions are derived).
> > 
> > Michaël
> 
> 




More information about the postgis-users mailing list