[postgis-users] ERROR: pt_in_ring_2d: V[n] != V[0]

Stephen Woodbridge woodbri at swoodbridge.com
Thu Dec 8 10:15:59 PST 2011


This was loaded via:

ogr2ogr -t_srs EPSG:4326 out.shp in.shp

This complained about something but seems to have passed on at least 
some of the problems.

shp2pgsql ...

No complaints there - so maybe this command should be extended to 
validate geometry and have a rule for how to handle bad ones like NULL 
the geom or try to fix it, etc.

I was able to locate the first issue, and after about 30 mins of trying 
this and that was able to locate the bad record and dump with astext and 
manually copy the start point  to an new end point and fix that.

The problem is I have 503 more records that are not valid and want to 
fix them but the tools do not allow me to easily sort out the simple 
invalid from the more severe ones because these commands are dying on 
fatal errors instead of recognizing it is a fatal condition are 
reporting it appropriately. :(

So my first need it to sort the simple and problematic cases. Any ideas 
on this?

Thanks,
   -Steve

On 12/8/2011 12:17 PM, Paul Ramsey wrote:
> Somehow you've snuck an unclosed polygon into the system. They don't
> usually get in, because the parser disallows them.
> This will make dumping a test data tricky at best...
> P.
>
> On Thu, Dec 8, 2011 at 8:42 AM, Stephen Woodbridge
> <woodbri at swoodbridge.com>  wrote:
>> Hi all,
>>
>> I'm getting this error:
>>
>> select gid from parcels where not isvalid(the_geom);
>> ERROR:  pt_in_ring_2d: V[n] != V[0] (-83.5001 38.244 != -83.5001 38.244)
>>
>> ********** Error **********
>>
>> ERROR: pt_in_ring_2d: V[n] != V[0] (-83.5001 38.244 != -83.5001 38.244)
>> SQL state: XX000
>>
>> select gid, st_isvalidreason(the_geom) from parcels where not
>> isvalid(the_geom);
>> NOTICE:  IllegalArgumentException: Invalid number of points in LinearRing
>> found 3 - must be 0 or>= 4
>> NOTICE:  IllegalArgumentException: Invalid number of points in LinearRing
>> found 3 - must be 0 or>= 4
>> ERROR:  POSTGIS2GEOS conversion failed
>>
>> ********** Error **********
>>
>> ERROR: POSTGIS2GEOS conversion failed
>> SQL state: XX000
>>
>> "POSTGIS="1.5.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008"
>> LIBXML="2.6.32" USE_STATS"
>>
>> This just seems very bad in that isvalid() and st_isvalidreason() should
>> never fail, IMO.
>>
>> -Steve
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> 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