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

Sandro Santilli strk at keybit.net
Tue Mar 11 09:05:30 PDT 2014


On Tue, Mar 11, 2014 at 04:49:16PM +0100, Christoph Lingg | komoot wrote:
> Hi Sandro,
> 
> thanks for your reply!
> 
> > ST_Intersects() is expected to possibly throw an exception
> > when the input is invalid.
>
> So why does the first query not throw an exception?

You've been lucky. See "possibly".

> I was told that invalid geometries are quite common in real life, and rounding errors being one source of that. Maybe that’s wrong!?

It's true, they are common, but you still need to clean them up.

> Invalid geometries are giving my a hard time at the moment, so I was thinking about adding a validity check:
> 
> > WHERE st_intersects(a1.area, a2.area) AND st_isvalid(a2.area)

Better swap, and cross fingers hoping that the planner decides
to run st_isvalid first.

> or
> 
> > WHERE st_intersects(a1.area, st_makevalid(a2.area))

Better yet, update your table with the result of the non-cheap operation
"ST_MakeValid".

> But I don’t know if this is the way to go, since i’am concerned about performance overhead of st_isvalid. Do you know how performant this function is?

Clean them once, as soon as they enter the database.
Both ST_MakeValid and ST_IsValid are non trivial.

--strk; 

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


More information about the postgis-users mailing list