Intersection operators
更新时间:
复制 MD 格式
INTERSECT operators return true if the bounding box of the left operand intersects the bounding box of the right operand in a specified dimension. Bounding boxes are computed by ST_MakeBox.
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}
Each operator accepts geometry, trajectory, or boxndf operands (see the syntax above for per-operator type constraints) and returns a boolean value.
Operators
The operators are organized by the spatial or temporal dimensions they check.
Spatial dimensions only
| Operator | Dimensions checked | Supported operand types |
|---|---|---|
&& |
x, y | geometry, trajectory, boxndf |
/&/ |
z | geometry, trajectory, boxndf |
&/& |
x, y, z | geometry, trajectory, boxndf |
Temporal dimension only
| Operator | Dimensions checked | Supported operand types |
|---|---|---|
#&# |
t | trajectory, boxndf |
Combined spatial and temporal dimensions
| Operator | Dimensions checked | Supported operand types |
|---|---|---|
&#& |
x, y, t | trajectory, boxndf |
&/#& |
x, y, z, t | trajectory, boxndf |
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. |
Example
The following example creates two bounding boxes and applies all six INTERSECT operators. The z-only operator /&/ and the t-only operator #&# return t (true), while all operators that include x and y dimensions return f (false) — the two boxes overlap in z and t but not in the x-y plane.
WITH box AS(
SELECT ST_MakeBox3d(0,0,0,5,5,5) a,
ST_MakeBox3dt(6,6, 3,'2010-04-12 00:00:00',8,8,5,'2013-02-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 | t | f | f | f | f
该文章对您有帮助吗?