メインコンテンツまでスキップ
バージョン: 2.1

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 |
+------------------------------------------------------------------------------------------+