Contained by operator

更新时间:
复制 MD 格式

The INCLUDED operators check whether the bounding box of the left operand is contained within the bounding box of the right operand in a specified dimension. Bounding boxes are generated by the ST_MakeBox function. The INCLUDED operators are the inverse of the INCLUDE 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}

Operators

Each operator checks containment in a different set of spatial or temporal dimensions:

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 3D bounding boxes using ST_MakeBox3dt and tests all six INCLUDED operators. Box b is fully contained within box a in the x, y, and z dimensions, but extends beyond a in the t dimension.

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;

Output:

 opz | opt | op2d | op3d | op2dt | op3dt
-----+-----+------+------+-------+-------
 t   | f   | t    | t    | f     | f

Box b is contained within box a in the z dimension (OpZ = t), the x-y dimensions (Op2D = t), and the x-y-z dimensions (Op3D = t). Because box b extends beyond a in the t dimension (end time 2013 vs. 2012), the operators that include the t dimension return false.

See also

  • INCLUDE operators — the inverse operators that check whether the left operand's bounding box contains the right operand's bounding box

  • ST_MakeBox — generates the bounding box used by these operators