メインコンテンツまでスキップ

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