ST_Within — Return true if no points of raster rastA lie in the exterior of raster rastB and at least one point of the interior of rastA lies in the interior of rastB.
boolean ST_Within(
                        raster 
                        rastA
                    , 
                        integer 
                        nbandA
                    , 
                        raster 
                        rastB
                    , 
                        integer 
                        nbandB
                    );
boolean ST_Within(
                        raster 
                        rastA
                    , 
                        raster 
                        rastB
                    );
Raster rastA is within rastB if and only if no points of rastA lie in the exterior of rastB and at least one point of the interior of rastA lies in the interior of rastB. If the band number is not provided (or set to NULL), only the convex hull of the raster is considered in the test. If the band number is provided, only those pixels with value (not NODATA) are considered in the test.
| ![[Note]](../images/note.png) | |
| This operand will make use of any indexes that may be available on the rasters. | 
| ![[Note]](../images/note.png) | |
| To test the spatial relationship of a raster and a geometry, use ST_Polygon on the raster, e.g. ST_Within(ST_Polygon(raster), geometry) or ST_Within(geometry, ST_Polygon(raster)). | 
| ![[Note]](../images/note.png) | |
| ST_Within() is the inverse of ST_Contains(). So, ST_Within(rastA, rastB) implies ST_Contains(rastB, rastA). | 
Availability: 2.1.0