开发者

How to check if two polygons intersect in Postgres?

开发者 https://www.devze.com 2023-02-11 23:05 出处:网络
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))\';

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

0

精彩评论

暂无评论...
验证码 换一张
取 消