ST_CONTAINS
描述
判断几何图形 shape1 是否完全能够包含几何图形 shape2
语法
ST_Contains( <shape1>, <shape2>)
参数
参数 | 说明 |
---|---|
<shape1> | 传入的几何图形,用于判断是否包含 shape2 |
<shape2> | 传入的几何图形,用于判断是被 shape1 包含 |
返回值
返回 1:shape1 图形可包含图形 shape2
返回 0:shape1 图形不可包含图形 shape2
举例
SELECT ST_Contains(ST_Polygon("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"), ST_Point(5, 5));
+----------------------------------------------------------------------------------------+
| st_contains(st_polygon('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'), st_point(5.0, 5.0)) |
+----------------------------------------------------------------------------------------+
| 1 |
+----------------------------------------------------------------------------------------+
SELECT ST_Contains(ST_Polygon("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"), ST_Point(50, 50));
+------------------------------------------------------------------------------------------+
| st_contains(st_polygon('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'), st_point(50.0, 50.0)) |
+------------------------------------------------------------------------------------------+
| 0 |
+------------------------------------------------------------------------------------------+