A newer PostGIS should give you a valid return from ST_IsValidReason rather than an exception for those non-closed linear rings. And the ST_MakeValid function should close them for you.
I'm afraid "newer" means 2.0.0SVN here, which also means dump-reload (I hope you do can dump, can you ?) For a "simpler" solution you'll need to write a function to ensure rings are closed. --strk; On Fri, Aug 19, 2011 at 03:36:27PM +0530, Mr. Puneet Kishor wrote: > > On Aug 19, 2011, at 10:26 AM, Mr. Puneet Kishor wrote: > > > Ben, > > > > On Aug 18, 2011, at 10:04 PM, Ben Madin wrote: > > > >> SELECT gid, st_isvalidreason(the_geom), st_summary(the_geom) FROM data > >> WHERE st_isclosed(the_geom) is FALSE; > > > > > > I am not entirely sure what the above was supposed to accomplish (I am > > assuming it would have given me the reason for features being invalid), > > however, I ran the query and I got 0 (zero) rows. > > > > hmmmm.... a bit more on the above > > SELECT Count(*) FROM data WHERE ST_IsClosed(the_geom) IS FALSE; > 0 rows > > SELECT Count(*) FROM data WHERE ST_IsValid(the_geom) IS FALSE; > NOTICE: IllegalArgumentException: Points of LinearRing do not form a closed > linestring > NOTICE: IllegalArgumentException: Points of LinearRing do not form a closed > linestring > NOTICE: Ring Self-intersection at or near point -125.35 63.3748 > NOTICE: Ring Self-intersection at or near point -105.317 25.7493 > NOTICE: Ring Self-intersection at or near point -79.7995 15.6005 > NOTICE: Ring Self-intersection at or near point -108.085 29.1395 > NOTICE: Ring Self-intersection at or near point -110.182 25.8712 > NOTICE: Self-intersection at or near point -119.188 77.3311 > NOTICE: Ring Self-intersection at or near point -120.647 48.8028 > NOTICE: Ring Self-intersection at or near point -124.845 61.0461 > NOTICE: Ring Self-intersection at or near point -100.63 62.7163 > NOTICE: Self-intersection at or near point -69.7338 64.1648 > NOTICE: Self-intersection at or near point -69.2501 58.2279 > NOTICE: Self-intersection at or near point -65.9125 52.0649 > NOTICE: Ring Self-intersection at or near point -74.8998 50.7265 > NOTICE: Self-intersection at or near point -82.6883 72.1031 > NOTICE: Ring Self-intersection at or near point -27.1663 71.0088 > NOTICE: Ring Self-intersection at or near point -99.0254 23.1045 > NOTICE: Ring Self-intersection at or near point -93.6802 37.1155 > NOTICE: Ring Self-intersection at or near point -73.2305 9.59044 > NOTICE: Ring Self-intersection at or near point -63.4384 13.1596 > 21 rows > > SELECT gid, ST_IsValidReason(the_geom) FROM data WHERE ST_isvalid(the_geom) > IS FALSE; > NOTICE: IllegalArgumentException: Points of LinearRing do not form a closed > linestring > NOTICE: IllegalArgumentException: Points of LinearRing do not form a closed > linestring > > > ERROR: POSTGIS2GEOS conversion failed > > ********** Error ********** > > ERROR: POSTGIS2GEOS conversion failed > SQL state: XX000 > > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users -- () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.html _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
