如何在 Postgres 中检查两个多边形是否相交?
在 PG 8.3 中如何检查两个多边形是否相交?
#
和 #?
不适用于多边形:
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
并且 &&
给出错误的答案:
select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))';
?column?
----------
t
(1 row)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 9 版 Postgres 的一个已知问题:http://archives。 postgresql.org/pgsql-bugs/2011-02/msg00139.php
It is a known issue with pre-9 Postgres: http://archives.postgresql.org/pgsql-bugs/2011-02/msg00139.php