ST_Equals()¶
Returns
1when two geometries are spatially equal, independent of coordinate ordering.
Syntax¶
ST_Equals(geom1, geom2)
Aliases: none.
Arguments¶
geom1 and geom2 are GEOMETRY values.
Return Value¶
Returns BOOL.
Usage Notes¶
Spatial equality compares represented geometry rather than WKT text order.
Both geometries must have the same SRID. Predicates are Cartesian (SRID 0), not geodetic SRID 4326 predicates.
Examples¶
DROP DATABASE IF EXISTS geo_equals_demo;
CREATE DATABASE geo_equals_demo;
USE geo_equals_demo;
SELECT ST_Equals(ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_GeomFromText('POLYGON((2 0, 2 2, 0 2, 0 0, 2 0)')) AS polygons_equal;
DROP DATABASE geo_equals_demo;
See Also¶
ST_Overlaps(), ST_Intersects().