ST_Equals
Signature
BOOLEAN ST_Equals(GEOMETRY geomA, GEOMETRY geomB);
Description
Return TRUE if geomA is topologically equal to geomB.
Equal means:
Shapes of
geomAandgeomBhave exactly the same shape. I.e.,ST_Within(A, B) = trueandST_Within(B, A) = true.The directionality and the order of points is ignored.
Note
Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1
Warning
This predicate does not yet support spatial indices, but it will in a future release. Use it in conjunction with && operator. See here for more details.
Examples
Cases where ST_Equals is true
SELECT ST_Equals(geomA, geomB) FROM input_table;
-- Answer: TRUE
geomA POLYGON |
geomB POLYGON |
|---|---|
POLYGON((1 1, 4 1, 4 4, 1 4, 1 1)) |
POLYGON((1 1, 4 1, 4 4, 1 4, 1 1)) |

geomA POLYGON |
geomB POLYGON |
|---|---|
POLYGON((1 1, 4 1, 4 4, 1 4, 1 1)) |
POLYGON((4 4, 4 1, 1 1, 1 4, 4 4)) |

geomA LINESTRING |
geomB LINESTRING |
|---|---|
LINESTRING(1 1, 4 4) |
LINESTRING(1 1, 3 3, 4 4) |
