ST_EqualsExact

Introduction: Returns true if A and B have the same structure and their corresponding coordinates are equal within a tolerance.

Unlike ST_Equals, this predicate requires geometry types, component order, ring order, and vertex order to match. The tolerance is the maximum distance allowed between each pair of corresponding coordinates. The comparison uses x and y coordinates and ignores Z and M coordinates.

Format: ST_EqualsExact (A: Geometry, B: Geometry, tolerance: Double)

Return type: Boolean

Since: v1.9.1

SQL Example

SELECT ST_EqualsExact(
    ST_GeomFromWKT('POINT (0 0)'),
    ST_GeomFromWKT('POINT (0.03 0.04)'),
    0.05
)

Output:

true

The order of coordinates must match:

SELECT ST_EqualsExact(
    ST_GeomFromWKT('LINESTRING (0 0, 1 1)'),
    ST_GeomFromWKT('LINESTRING (1 1, 0 0)'),
    0.0
)

Output:

false