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

Paul Ramsey pramsey at opengeo.org
Thu Dec 8 14:06:34 PST 2011


One and the same problem, you can't have a closed non-touching polygon
with 3 points.

On Thu, Dec 8, 2011 at 12:48 PM, Stephen Woodbridge
<woodbri at swoodbridge.com> wrote:
> Upgraded to PostGIS 1.5.3 and get the same problem.
>
>
> select gid, st_isvalidreason(the_geom) from parcels where not
> isvalid(the_geom);
> ...<lots of non-fatal notice massages>
> NOTICE:  Ring Self-intersection at or near point -84.5006 38.044
> NOTICE:  Ring Self-intersection at or near point -84.5064 37.988
> NOTICE:  Ring Self-intersection at or near point -84.5097 38.0421
> NOTICE:  Self-intersection at or near point -84.4921 38.0534
> NOTICE:  Ring Self-intersection at or near point -84.5265 38.0425
>
> 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
>
> So it looks like there are at least to issues:
>
> 1. open rings
> 2. invalid number of points in ring
>
> that are causing problems.
>
> Thanks,
>  -Steve
>
>
> On 12/8/2011 1:25 PM, Paul Ramsey wrote:
>>
>> First confirm if PostGIS 1.5.3 is any better.
>> If it's not, this should not be a major problem to fix.
>> P.
>>
>> On Thu, Dec 8, 2011 at 10:15 AM, Stephen Woodbridge
>> <woodbri at swoodbridge.com>  wrote:
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>
>
> _______________________________________________
> 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