INCLUDE operators
Updated at:
Copy as MD
Use INCLUDE operators to check whether the bounding box of the left operand contains the bounding box of the right operand in a specified dimension. Bounding boxes are generated by the ST_MakeBox function. For the inverse operation, see INCLUDED operators.
Syntax
{geometry, trajectory, boxndf} /@>/ {geometry, trajectory, boxndf}
{trajectory, boxndf} #@># {trajectory, boxndf}
{geometry, trajectory, boxndf} @> {geometry, trajectory, boxndf}
{geometry, trajectory, boxndf} @/> {geometry, trajectory, boxndf}
{trajectory, boxndf} @#> {trajectory, boxndf}
{trajectory, boxndf} @/#> {trajectory, boxndf}
All operators return boolean.
Parameters
| Parameter | Description |
|---|---|
| Left operand | The object whose bounding box you want to compare. |
| Right operand | The object whose bounding box you want to compare. |
Operators
Each operator answers the question: does the left operand's bounding box contain the right operand's bounding box, scoped to specific dimensions?
| Operator | Dimensions checked | Supported types |
|---|---|---|
/@>/ |
z | geometry, trajectory, boxndf |
#@># |
t | trajectory, boxndf |
@> |
x and y | geometry, trajectory, boxndf |
@&> |
x, y, and z | geometry, trajectory, boxndf |
<#@ |
x, y, and t | trajectory, boxndf |
@/#> |
x, y, z, and t | trajectory, boxndf |
Note: The source documentation describes<#@as checking whether the bounding box of the left operand-specified object is included in the bounding box of the right operand-specified object in the x, y, and t dimensions. Similarly,@/#>is described as checking whether the bounding box of the left operand-specified object is included in the bounding box of the right operand-specified object in the x, y, z, and t dimensions. Bounding boxes used in comparisons are generated by theST_MakeBoxfunction. For details, see ST_MakeBox.
Example
The following example creates two boxes using ST_MakeBox3dt and applies all six INCLUDE operators. Box a spans x/y/z (0–10) and time range 2010–2012. Box b spans x/y/z (6–8, 6–8, 3–5) and time range 2010–2013. The results show which dimensions of a fully contain b.
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 a /@>/ b AS OpZ, a #@># b AS OpT, a @> b AS Op2D, a @/> b AS Op3D, a @#> b AS Op2DT, a @/#> b AS Op3DT from box;
opz | opt | op2d | op3d | op2dt | op3dt
-----+-----+------+------+-------+-------
t | f | t | t | f | f
Reading the results:
| Alias | Operator | Result | Reason |
|---|---|---|---|
| OpZ | /@>/ |
t |
Box a contains box b in the z dimension (0–10 contains 3–5) |
| OpT | #@># |
f |
Box a does not contain box b in the t dimension (2010–2012 does not contain 2010–2013) |
| Op2D | @> |
t |
Box a contains box b in x and y (0–10 contains 6–8 on both axes) |
| Op3D | @/> |
t |
Box a contains box b in x, y, and z |
| Op2DT | @#> |
f |
Box a does not contain box b in x, y, and t (t dimension fails) |
| Op3DT | @/#> |
f |
Box a does not contain box b in x, y, z, and t (t dimension fails) |
Is this page helpful?