Name

~= — Returns TRUE if A's bounding box is the same as B's.

Synopsis

boolean ~=( geometry A , geometry B );

Description

The ~= operator returns TRUE if the bounding box of geometry/geography A is the same as the bounding box of geometry/geography B.

[Note]

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

Availability: 1.5.0 changed behavior

[Warning]

This operator has changed behavior in PostGIS 1.5 from testing for actual geometric equality to only checking for bounding box equality. To complicate things it also depends on if you have done a hard or soft upgrade which behavior your database has. To find out which behavior your database has you can run the query below. To check for true equality use ST_OrderingEquals or ST_Equals and to check for bounding box equality =; operator is a safer option.

Examples


select 'LINESTRING(0 0, 1 1)'::geometry ~= 'LINESTRING(0 1, 1 0)'::geometry as equality;
 equality   |
-----------------+
          t    |
 			

The above can be used to test if you have the new or old behavior of ~= operator.

See Also

ST_Equals, ST_OrderingEquals, =