栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

st_intersects与st_overlaps

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

st_intersects与st_overlaps

从PostGIS的文档中

http://postgis.net/docs/ST_Intersects.html

如果几何或地理共享空间的任何部分,则它们相交。重叠,触摸,所有暗示空间相交。如果上述任何一项返回true,则几何形状也会在空间上相交。

http://postgis.net/docs/ST_Overlaps.html

如果几何“空间重叠”,则返回TRUE。我们的意思是它们相交,但是一个并不完全包含另一个。

区别是:如果两个几何重叠100%,则它们不再重叠。

这是一个POSTGIS示例:

SELECt ST_Overlaps(a,b) As a_overlap_b, ST_Intersects(a, b) As a_intersects_b, ST_Contains(b, a) As b_contains_aFROM (SELECt     ST_Polygon(ST_GeomFromText('LINESTRING(1 1,3 1,3 3,1 1)'), 4326)  As a,    ST_Polygon(ST_GeomFromText('LINESTRING(1 1,3 1,3 3,1 1)'), 4326)  As b)    As foo;    -- INTERSECT is TRUE, OVERLAP is FALSE because B equals A    SELECt ST_Overlaps(a,b) As a_overlap_b, ST_Intersects(a, b) As a_intersects_b, ST_Contains(b, a) As b_contains_aFROM (SELECt     ST_Polygon(ST_GeomFromText('LINESTRING(1 1,3 1,3 3,1 1)'), 4326)  As a,    ST_Polygon(ST_GeomFromText('LINESTRING(1 1,4 1,4 4,1 1)'), 4326)  As b)    As foo;    -- INTERSECT is TRUE, OVERLAP is FALSE because B contains A    SELECt ST_Overlaps(a,b) As a_overlap_b, ST_Intersects(a, b) As a_intersects_b, ST_Contains(b, a) As b_contains_aFROM (SELECt     ST_Polygon(ST_GeomFromText('LINESTRING(0 0,2 0,2 2,0 0)'), 4326)  As a,    ST_Polygon(ST_GeomFromText('LINESTRING(1 1,3 1,3 3,1 1)'), 4326)  As b)    As foo;    -- INTERSECT is TRUE, OVERLAP is TRUE because not all of A intersects B and not all of B intersects A


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/370799.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号