ST_Contains参数的数据类型
时间: 2024-02-05 08:12:08 浏览: 36
ST_Contains是PostGIS中的一个空间查询函数,用于判断一个几何对象是否包含另一个几何对象。其参数的数据类型应该是两个几何对象,可以是点、线、面等。
具体来说,ST_Contains函数的第一个参数是一个多边形或多面几何对象,第二个参数是一个点、线、多点、多线或多面几何对象。如果第二个几何对象完全包含在第一个几何对象内部,则函数返回true,否则返回false。
示例:
```
SELECT ST_Contains(polygon_geom, point_geom) FROM my_table;
```
其中,polygon_geom和point_geom分别是两个几何对象的列名。函数将返回一个布尔值,表示point_geom是否包含在polygon_geom内部。
相关问题
ST_Contains
ST_Contains 是 PostGIS 中的一个函数,用于判断一个几何对象是否包含另一个几何对象。它的语法如下:
```
ST_Contains(geometry A, geometry B);
```
其中,A 和 B 是两个几何对象,可以是点、线、面等。如果 A 包含 B,则返回 true,否则返回 false。
例如,假设有一个名为 polygons 的表,其中包含一个名为 geom 的几何列,我们可以使用以下语句查询所有包含点 (1,1) 的多边形:
```
SELECT * FROM polygons WHERE ST_Contains(geom, ST_GeomFromText('POINT(1 1)'));
```
其中,ST_GeomFromText 函数用于将文本表示的几何对象转换为 PostGIS 的几何对象。
postgresql st_contains
`ST_Contains` is a PostGIS function that checks if a geometry (such as a point, line or polygon) is completely inside another geometry. It returns true if the first geometry is completely inside the second geometry, otherwise it returns false.
Here's an example usage of `ST_Contains` in PostgreSQL:
```
SELECT *
FROM table1
WHERE ST_Contains(table1.geom, table2.geom);
```
This query selects all records from `table1` where the geometry in the `geom` column of `table1` is completely inside the geometry in the `geom` column of `table2`.
Note that `ST_Contains` only works with two-dimensional geometries. If you are working with three-dimensional geometries, you should use `ST_3DContains` instead.
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)