There are five topological operators: overlaps (&&
), contains (@>
), contained (<@
), same (~=
), and adjacent (-|-
). The operators verify the topological relationship between the bounding boxes taking into account the value and/or the time dimension for as many dimensions that are present on both arguments.
The topological operators for bounding boxes are given next.
Do the bounding boxes overlap?
box && box: boolean
SELECT tbox 'TBOX((1,2001-01-01),(3,2001-01-03))' && tbox 'TBOX((2,2001-01-02),(4,2001-01-04))'; -- true SELECT stbox 'STBOX T((1,1,2001-01-01),(2,2,2001-01-02))'&& stbox 'STBOX T((,2001-01-02),(,2001-01-02))'; -- true
Does the first bounding box contain the second one?
box @> box: boolean
SELECT tbox 'TBOX((1,2001-01-01),(4,2001-01-04))' @> tbox 'TBOX((2,2001-01-01),(3,2001-01-02))'; -- true SELECT stbox 'STBOX Z((1,1,1),(3,3,3))' @> stbox 'STBOX T((1,1,2001-01-01),(2,2,2001-01-02))'; -- true
Is the first bounding box contained in the second one?
box <@ box: boolean
SELECT tbox 'TBOX((1,2001-01-01),(2,2001-01-02))' <@ tbox 'TBOX((1,2001-01-01),(2,2001-01-02))'; -- true SELECT stbox 'STBOX T((1,1,2001-01-01),(2,2,2001-01-02))' <@ stbox 'STBOX ZT((1,1,1,2001-01-01),(2,2,2,2001-01-02))'; -- true
Are the bounding boxes equal in their common dimensions?
box ~= box: boolean
SELECT tbox 'TBOX((1,2001-01-01),(2,2001-01-02))' ~= tbox 'TBOX((,2001-01-01),(,2001-01-02))'; -- true SELECT stbox 'STBOX T((1,1,2001-01-01),(3,3,2001-01-03))' ~= stbox 'STBOX Z((1,1,1),(3,3,3))'; -- true
Are the bounding boxes adjacent?
box -|- box: boolean
Two boxes are adjacent if they share n dimensions and their intersection is at most of n-1 dimensions.
SELECT tbox 'TBOX((1,2001-01-01),(2,2001-01-02))' -|- tbox 'TBOX((,2001-01-02),(,2001-01-03))'; -- true SELECT stbox 'STBOX T((1,1,2001-01-01),(3,3,2001-01-03))' -|- stbox 'STBOX T((2,2,2001-01-03),(4,4,2001-01-04))'; -- true