[postgis-users] newbie question about non closed rings

Paragon Corporation lr at pcorp.us
Wed Apr 15 00:27:37 PDT 2009


Ge,
I can't render the WKT representation of this since its so invalid.  I'm
guessing that you have a polygon that has rings that aren't closed.

So something like

SELECT ST_geomFromText('POLYGON((1 2, 2 2, 3 4))')

Is invalid

But something like this
SELECT ST_geomFromText('POLYGON((1 2, 2 2 , 3 4, 1 2))')

Is  okay

A valid polygon has to have the starting point be the same as the closing
point and all the rings (like the things that make up the holes and exterior
in the geometry must also have closed rings (start point coincident with
end).

The easiest way to troubleshoot this is to use the -w switch of shp2pgsql as
itemized here 
http://www.bostongis.com/pgsql2shp_shp2pgsql_quickguide.bqg?outputformat=PDF


then it will render a readable WKT geometry format and then send that to the
list.  You may need to take out the begin commit of your sql batch file to
pinpoint the culprit if you don't know which one already.

Hope that helps,
Regina






-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of G. van
Es
Sent: Wednesday, April 15, 2009 2:34 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] newbie question about non closed rings


Hi All,

I am a bit new to this so excuse me if this is a foolish question.

Can anyone tell me what is wrong with the following geometry?

'0106000000010000000103000000010000000700000024213D12AA7BFD40945FF4257651194
1676A32F9017BFD40B1D67BEA7E511941C3E3C640DB7DFD4026CE38F4EE531941C91289C5AA7
EFD40017B8518E3531941646F1599AB7DFD409627F1F0AE521941355EBA49547CFD407B14AEC
74652194123213D12AA7BFD40945FF42576511941'

I have a shapefile converted with shp2pgsql. Some records will not insert
due to the ERROR: geometry contains non-closed rings. The shapefile itself
is viewable without problems.

Thanks,
Ge



      
_______________________________________________
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