Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

POSTGIS TopologyException: side location conflict

I'm trying to execute a simple st_intersects query:

select st_intersects('MULTIPOLYGON(((1 5,4 8,7 5,4 2,1 5)),((5 5,8 8,11 5,8 2,5 5)))','POLYGON((3 4.5,3 5,4 5,4 4,3 4.5))');

which crush the console and returns the following error:

Error: GEOSIntersects: TopologyException: side location conflict at: 6 4

Which is completely odd because the following query works:

select st_intersects('MULTIPOLYGON(((1 5,4 8,7 5,4 2,1 5)),((5 5,8 8,11 5,8 2,5 5)))','POLYGON((3 4,3 5,4 5,4 4,3 4))');

The only difference between the two is the 4 / 4.5 in the last polygon..

I use POSTGIS version 2.2.1 what am i missing here?

like image 257
Eden Katabi Avatar asked Jan 05 '23 09:01

Eden Katabi


1 Answers

I found a relevant solution to my problem.

select st_intersects(st_buffer('MULTIPOLYGON(((1 5,4 8,7 5,4 2,1 5)),((5 5,8 8,11 5,8 2,5 5)))',0),'POLYGON((3 4.5,3 5,4 5,4 4,3 4.5))');

When i added the st_buffer it merge the two polygons of the multipolygon to one and solved the issue.

like image 94
Eden Katabi Avatar answered Jan 08 '23 09:01

Eden Katabi