Name

ST_Equals — Tests if a Geometry is spatially equal to another Geometry, returns True if so.

Synopsis

boolean ST_Equals(bytea GeomA, bytea GeomB);

Alias

Equals

Description

Tests if a Geometry is spatially equal to another Geometry, returns True if so.

The DE-9IM Intersection Matrix for the two geometries is T*F**FFF*

Note that this method computes topologically equality, not structural or vertex-wise equality (use ST_OrderingEquals for that).

[Note]

GeometryCollections are unsupported

Coordinate Dimensions
2D3DM

-

-

Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.1.2 , 2.1.13.37.2.19.17.2.8.15.1.24

Examples

SELECT ST_Equals(ga,gb) from (SELECT ST_GeomFromText('LINESTRING (0 0, 10 10, 10 5, 15 10)') as ga, 
       ST_GeomFromText('LINESTRING (15 10, 10 5, 10 10, 5 5, 0 0)') as gb) as foo;
--Result
TRUE

SELECT ST_Equals(ga,gb) from (SELECT ST_GeomFromText('LINESTRING (0 0 8, 10 10 2)') as ga, 
       ST_GeomFromText('LINESTRING (10 10 4, 0 0 2)') as gb) as foo;
--Result
TRUE

Related functions

ST_OrderingEquals