[postgis-devel] Allowing import of polygons with non-closed rings (was: GSHHS and "geometry contains non-closed rings)

Sandro Santilli strk at keybit.net
Mon Oct 21 13:50:25 PDT 2013


On Mon, Oct 21, 2013 at 01:22:44PM +0200, Sandro Santilli wrote:
> On Mon, Oct 21, 2013 at 01:11:04PM +0200, Guglielmo Celata wrote:

> > I am trying to insert some data from GSHHS (http://www.ngdc.noaa.gov/mgg/shorelines/data/gshhg/latest/), 
> > into Posgis2  (Postgresql 9.1).
> > 
> > I receive the  "geometry contains non-closed rings" error on one of the imports.
> 
> The input is invalid, in that it contains non-closed rings.
> And the WKT parsers don't let you input those kind of geometries, unfortunately.
> 
> Your only option here is to tweak the input to be valid, or skip the
> invalid records.

I've been thinking you probably have another option, being using the HEXWKB
parser, which should let those geometries in. Please try importing those
shapefiles with shp2pgsql and let us know.

--strk;

> I'd be in favor of letting such invalid geometries in, since we have tools that
> lets you clean them up after import. Feel like filing an enhancement ticket
> for that ?
> 
> See also http://trac.osgeo.org/postgis/ticket/2395 for another similar case
> (KML input in that case, but same problem).
> 
> --strk;
> 
> 



More information about the postgis-devel mailing list