postgresql st_contains
时间: 2023-07-22 18:25:45 浏览: 125
`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.
阅读全文