[postgis-users] ST_Intersection error side location conflict

Paolo Crosato paolo.crosato at targaubiest.com
Fri Nov 30 03:38:23 PST 2012


Il 30/11/2012 11:16, Sandro Santilli ha scritto:
> On Fri, Nov 30, 2012 at 11:03:55AM +0100, Paolo Crosato wrote:
>> Il 29/11/2012 18:10, Sandro Santilli ha scritto:
>>> On Thu, Nov 29, 2012 at 05:56:42PM +0100, Paolo Crosato wrote:
>>>> Hi,
>>>>
>>>> I tried all the suggestions.
>>>> 1) All geometries are closed, select count(*) from adminbndy4 where
>>>> ST_IsClosed(geom)='f' gives 0
>>>> 2) Yes I will add the intersect clause to the composite query on the
>>>> table, however for now I'm just trying to figure out why the example
>>>> I posted gives an error.
>>>> 3) 4) All the geometries in the table are valid, select count(*)
>>> >from adminbndy4 where ST_IsValid(geom)='f' returns 0. Anyway I tried
>>>> the buffer trick on the example I posted, but the error is still
>>>> there.
>>>>
>>>> Any other suggestion?
>>>> I thought about rounding to the 4th decimal with ST_SnapToGrid to
>>>> simplify things a bit, but It would be the very last option.
>>> Tried upgrading GEOS to 3.3.6 ?
>> Hi,
>>
>> I upgraded to 3.3.6, but the problem was still there. It turned out
>> to be a very simple issue, I was building the mask rectangle
>> clockwise rather than counterclockwise.
>> Once I reordered the points, eveything worked well, and blazing fast too :)
> For GEOS it shouldn't make any difference, so either you're hitting
> a robustness issue which is fixed by any random scrambing of input
> (for instance, the input may be triggering a snapping operation which is
> known to be orientation dependent) or you found a very stupid bug
> in GEOS (or PostGIS).
>
> Could you try to reproduce the error with two simple geometries in inputs ?
>
> --strk;

I couln't, but after further examination of my first request I spotted 
the real issue probably:

POLYGON((12.032661 45.38736,12.032661 45.667805,12.588158 
45.667805,12.032661 45.667805,12.032661 45.38736))

Point order is clockwise, but I mistyped the geometry too, it's going 
from SW to NW to NE to NW to SW, I skipped SE, so my own geometry was 
self bugged I think, If you call validation on it like:

SELECT ST_IsValid(ST_GeomFromText('POLYGON((12.032661 45.38736,12.032661 
45.667805,12.588158 45.667805,12.032661 45.667805,12.032661 
45.38736))',4326))
f

If you correct the polygon, as in:

POLYGON((12.032661 45.38736,12.032661 45.667805, 12.588158 
45.667805,12.588158 45.38736, 12.032661 45.38736))

still clockwise but now a real rectangle, the query works.

I should have spotted it before, but I got kind of distracted by 
interruptions and blabbers at worksite :p

Sorry for the time waste and thank you for the hint at 3.3.6, from the 
changelog it looks like a critical improvement.

Regards,

Paolo



More information about the postgis-users mailing list