[postgis-devel] [postgis-users] GSHHS and "geometry contains non-closed rings

Sandro Santilli strk at keybit.net
Mon Oct 21 04:22:44 PDT 2013


On Mon, Oct 21, 2013 at 01:11:04PM +0200, Guglielmo Celata wrote:
> Hi,
> 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.
> But right after that, Postgres is not able to insert anything in the DB.
> 
> I'm wondering if the data are wrong (they contain some un-closed geometries), or if the whole import
> is somehow wrogn or outdated.
> 
> Python source is taken from "Python Geospatial Development, 2nd. Edition", ch. 7.

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'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