RS_Within¶
Returns true if the first argument’s extent is within the second.
Usage¶
boolean RS_Within(rast: raster, geom: geometry)
boolean RS_Within(geom: geometry, rast: raster)
boolean RS_Within(rastA: raster, rastB: raster)
Arguments¶
- rastA (raster): Input raster
- rastB (raster): Input raster
- geom (geometry): Input geometry
- rast (raster): Input raster
Description¶
Returns true if the convex hull of the first argument is completely
within the second argument. This is the inverse of RS_Contains:
RS_Within(A, B) is equivalent to RS_Contains(B, A).
Both rasters and geometries are accepted in either argument position. When two rasters are provided, their convex hulls are compared.
If the arguments have different CRSes, the geometry is transformed into the raster’s CRS before evaluating the predicate. For two rasters, the second raster’s extent is transformed into the first raster’s CRS. If the preferred transformation fails, the extent of both sides are transformed to WGS 84 as a fallback. If either argument has no CRS set, the comparison is performed directly without CRS transformation.
Examples¶
SELECT RS_Within(
ST_Point(0.5, 0.5, 4326),
RS_Example()
);
┌─────────────────────────────────────────────────────────────────────────┐
│ rs_within(st_point(Float64(0.5),Float64(0.5),Int64(4326)),rs_example()) │
│ boolean │
╞═════════════════════════════════════════════════════════════════════════╡
│ false │
└─────────────────────────────────────────────────────────────────────────┘
SELECT RS_Within(RS_Example(), RS_Example());
┌──────────────────────────────────────┐
│ rs_within(rs_example(),rs_example()) │
│ boolean │
╞══════════════════════════════════════╡
│ true │
└──────────────────────────────────────┘