How to check if two polygons intersect in Postgres?
How can I check if two polygons intersect in PG 8.3?
#
and #?
don't work for polygons:
select polygon'((0,0), (1,2), (0,2))' # polygon'((0.5,开发者_开发问答 0), (1,0), (1,1))';
ERROR: operator does not exist: polygon # polygon
select polygon'((0,0), (1,2), (0,2))' #? polygon'((0.5, 0), (1,0), (1,1))';
ERROR: operator does not exist: polygon #? polygon
And &&
gives wrong asnwer:
select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
?column?
----------
t
(1 row)
It is a known issue with pre-9 Postgres: http://archives.postgresql.org/pgsql-bugs/2011-02/msg00139.php
精彩评论