[postgis-users] Problems with GeomUnion

Martin Davis mbdavis at VividSolutions.com
Thu Apr 7 17:17:49 PDT 2005


> 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 wonder why I didn't get errors when loading the shapefiles into the
database!

Shapefiles are notoriously tolerant of invalid geometry topology.  For
different reasons, so is PostGIS.  Sometimes it's nice to be able to
load invalid geometry and then clean it up in a subsequent step.  If
PostGIS refused to load your bad shape, you might have no way of knowing
what the bad linework was or what the error was.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.      www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046


> -----Original Message-----
> From: Bill Binko [mailto:bill at binko.net] 
> Sent: April 7, 2005 5:09 PM
> To: PostGIS Users Discussion
> Subject: RE: [postgis-users] Problems with GeomUnion
> 
> 
> On Thu, 7 Apr 2005, Martin Davis wrote:
> 
> > > 1) What tool did you use to find that?
> > 
> > JUMP 
> (http://www.jump-project.org/project.php?> PID=JUMP&SID=OVER)  
> has 
> > a Validation tool which can find 
> geometry validation errors.  You can 
> > just cut and paste WKT into layers in JUMP, and then 
> validate them.  
> > JUMP uses JTS, which is the Java API which the GEOS engine 
> in PostGIS 
> > is based on.
> > 
> > > 2) Is there a way to test shapes for validity in PostGIS?  Like an
> > > isvalid() function?
> > 
> > Yep - but I'm no PostGIS expert.  Others on the list can help with 
> > this, I'm sure.
> > 
> 
> Interesting: I added AND isvalid(parcel_shape) and it looks 
> to be working.
> 
> Now I need a way to fix self-intersecting shapes.  I wonder 
> why I didn't 
> get errors when loading the shapefiles into the database!
> 
> Oh well: thanks for getting me on the right track
> 
> Bill
> _______________________________________________
> postgis-users mailing list postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 



More information about the postgis-users mailing list