~

Name

~ — Returns TRUE if A's bounding box contains B's.

Synopsis

boolean ~ ( geometry A , geometry B ) ;

Description

The ~ operator returns TRUE if the bounding box of geometry A completely contains the bounding box of geometry B.

[Note]

This operand will make use of any indexes that may be available on the geometries.

Examples

SELECT tbl1.column1, tbl2.column1, tbl1.column2 ~ tbl2.column2 AS contains
FROM
  ( VALUES
	(1, 'LINESTRING (0 0, 3 3)'::geometry)) AS tbl1,
  ( VALUES
	(2, 'LINESTRING (0 0, 4 4)'::geometry),
	(3, 'LINESTRING (1 1, 2 2)'::geometry),
	(4, 'LINESTRING (0 0, 3 3)'::geometry)) AS tbl2;

 column1 | column1 | contains
---------+---------+----------
	   1 |       2 | f
	   1 |       3 | t
	   1 |       4 | t
(3 rows)

See Also

@ , &&