[postgis-users] GEOSIntersects: TopologyException: side location conflict at

Sandro Santilli strk at keybit.net
Tue Mar 11 08:41:14 PDT 2014


On Tue, Mar 11, 2014 at 04:31:28PM +0100, Christoph Lingg | komoot wrote:
> Hello everybody!
> 
> I encountered an unexpected behavior which could be bug. I have a table „areas“ with multipolygons and some of them are invalid. This is an example where "area 34172" is invalid:
> 
> > SELECT a2.id, st_isvalid(a2.area) FROM areas a1, areas a2 WHERE st_intersects(a1.area, a2.area) AND a1.id = 121229321;
> > NOTICE:  Self-intersection at or near point 17.018970899999999 48.108382500000005
> >     id     | st_isvalid 
> > -----------+------------
> >  121229321 | t
> >      16239 | t
> >      34172 | f
> >     112050 | t
> >      77189 | t
> >     933011 | t
> > (6 rows)
> 
> As far as I read you have to consider invalid geometries due to rounding errors, ok. The same query with an additional WHERE clause behaves unexpectedly:
> 
> > SELECT a2.id, st_isvalid(a2.area) FROM areas a1, areas a2 WHERE st_intersects(a1.area, a2.area) AND ((a2.annotations->'area') = 'yes') AND a1.id = 121229321;
> > ERROR:  GEOSIntersects: TopologyException: side location conflict at 17.018970899999999 48.108382500000005
> 
> 
> annotations is actually of type store. However, I expected results similar to the first query do I do something wrong?

ST_Intersects() is expected to possibly throw an exception
when the input is invalid. An invalid geometry must be
cleaned up, because it's intrinsically ambiguous about
what's inside and what's outside, what's "left" or "right",
so you can't ask if it intersects or not something else
because it is malformed.

Where did you read that we consider geometries invalid due
to rounding errors ?

--strk; 

 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  


More information about the postgis-users mailing list