Fork me on GitHub

ST_Equals

Signatures

BOOLEAN ST_Equals(GEOMETRY geomA, GEOMETRY geomB);

Description

Return true if geomA is topologically equal to geomB.

Equal means:

  • Shapes of geomA and geomB have exactly the same shape. I.e., ST_Within(A, B) = true and ST_Within(B, A) = true.
  • The directionality and the order of points is ignored.
Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1.
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)

See also