Returns true if a raster object is completely within another raster object or a geometry object. Both objects must share the same spatial reference system.
Syntax
bool ST_Within(raster rast1, raster rast2);
bool ST_Within(raster rast, geometry geom);
bool ST_Within(geometry geom, raster rast);Parameters
| Parameter | Description |
|---|---|
rast1 | The raster object to test (the candidate that may be within rast2). |
rast2 | The raster object that may contain rast1. |
rast | The raster object. |
geom | The geometry object. |
Examples
The following example checks which rasters in tbl_a are completely within the rasters in tbl_b.
SELECT a.id FROM tbl_a a, tbl_b b WHERE ST_Within(a.rast, b.rast);Output:
id
----
1
(1 row)