The INCLUDED operators test whether the bounding box of the left operand is contained within the bounding box of the right operand across a specified set of dimensions. They are the inverse of the INCLUDE operators, which test containment in the opposite direction. Bounding boxes are computed using ST_MakeBox.
Syntax
boolean /<@/ ( {geometry | trajectory | boxndf}, {geometry | trajectory | boxndf} )
boolean #<@# ( {trajectory | boxndf}, {trajectory | boxndf} )
boolean <@ ( {geometry | trajectory | boxndf}, {geometry | trajectory | boxndf} )
boolean </@ ( {geometry | trajectory | boxndf}, {geometry | trajectory | boxndf} )
boolean <#@ ( {trajectory | boxndf}, {trajectory | boxndf} )
boolean </#@ ( {trajectory | boxndf}, {trajectory | boxndf} )Each operator returns true if the left operand's bounding box is fully contained within the right operand's bounding box in the specified dimensions, and false otherwise.
Operators
The operator symbol encodes the dimensions it compares. A # prefix or suffix indicates the time dimension (t); a / prefix or suffix indicates the z dimension.
| Operator | Dimensions | Supported types |
|---|---|---|
/<@/ | z | geometry, trajectory, boxndf |
#<@# | t | trajectory, boxndf |
<@ | x, y | geometry, trajectory, boxndf |
</@ | x, y, z | geometry, trajectory, boxndf |
<#@ | x, y, t | trajectory, boxndf |
</#@ | x, y, z, t | trajectory, boxndf |
Example
The following example creates two bounding boxes and runs all six INCLUDED operators against them.
Box a spans x: 0–10, y: 0–10, z: 0–10, t: 2010–2012. Box b spans x: 6–8, y: 6–8, z: 3–5, t: 2010–2013.
WITH box AS (
SELECT ST_MakeBox3dt(0,0,0, '2010-01-01 00:00:00', 10,10,10, '2012-01-01 00:00:00') a,
ST_MakeBox3dt(6,6,3, '2010-01-01 00:00:00', 8, 8, 5, '2013-01-01 00:00:00') b
)
SELECT
b /<@/ a AS OpZ,
b #<@# a AS OpT,
b <@ a AS Op2D,
b </@ a AS Op3D,
b <#@ a AS Op2DT,
b </#@ a AS Op3DT
FROM box;Result:
opz | opt | op2d | op3d | op2dt | op3dt
-----+-----+------+------+-------+-------
t | f | t | t | f | fReading the results:
OpZ(/<@/) =t: boxb(z: 3–5) is fully within boxa(z: 0–10) in the z dimension.OpT(#<@#) =f: boxbends at 2013, which exceeds boxa's upper bound of 2012 in the t dimension.Op2D(<@) =t: boxb(x: 6–8, y: 6–8) is fully within boxa(x: 0–10, y: 0–10).Op3D(</@) =t: boxbis within boxain all three spatial dimensions (x, y, z).Op2DT(<#@) =f: boxbexceeds boxain the t dimension, so the combined x, y, and t containment check fails.Op3DT(</#@) =f: the t dimension overflow causes the full 4D containment check to fail.
What's next
INCLUDE operators — test whether the left operand's bounding box *contains* the right operand's bounding box (the inverse direction)
ST_MakeBox — query the bounding box of an object over a specified time range