カテゴリ：

# ST_WITHIN¶

Returns true if the the first geospatial object is fully contained by the second geospatial object. In other words:

• The first GEOGRAPHY object g1 is fully contained by the second GEOGRAPHY object g2.

• The first GEOMETRY object g1 is fully contained by the second GEOMETRY object g2.

Calling ST_WITHIN(g1, g2) is equivalent to calling ST_CONTAINS(g2, g1).

Although ST_COVEREDBY and ST_WITHIN might seem similar, the two functions have subtle differences. For details on the differences between "covered by" and "within", see the Dimensionally Extended 9-Intersection Model (DE-9IM).

この関数は、入力値として GeometryCollection または FeatureCollection を使用することをサポートしていません。

こちらもご参照ください。

## 構文¶

ST_WITHIN( <geography_expression_1> , <geography_expression_2> )

ST_WITHIN( <geometry_expression_1> , <geometry_expression_2> )


## 引数¶

geography_expression_1

GeometryCollection または FeatureCollection ではない GEOGRAPHY オブジェクト。

geography_expression_2

GeometryCollection または FeatureCollection ではない GEOGRAPHY オブジェクト。

geometry_expression_1

A GEOMETRY object that is not a GeometryCollection or FeatureCollection.

geometry_expression_2

A GEOMETRY object that is not a GeometryCollection or FeatureCollection.

BOOLEAN

## 例¶

### GEOGRAPHY Examples¶

これは、 ST_WITHIN 関数の簡単な使用法を示しています。

create table geospatial_table_01 (g1 GEOGRAPHY, g2 GEOGRAPHY);
insert into geospatial_table_01 (g1, g2) values
('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))', 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))');

SELECT ST_WITHIN(g1, g2)
FROM geospatial_table_01;
+-------------------+
| ST_WITHIN(G1, G2) |
|-------------------|
| False             |
+-------------------+