Fork me on GitHub

ST_OrderingEquals

Signature

BOOLEAN ST_OrderingEquals(GEOMETRY geomA, GEOMETRY geomB);

Description

Returns TRUE if geomA and geomB are equal and their coordinates and component Geometries are listed in the same order. The condition is stronger than ST_Equals.

Examples

-- The same:
SELECT ST_OrderingEquals('LINESTRING(0 0 1, 0 0, 10 10 3)',
                         'LINESTRING(0 0 1, 0 0, 10 10 3)');
-- Answer: TRUE

-- Different:
SELECT ST_OrderingEquals('LINESTRING(0 0, 10 10)',
                         'LINESTRING(0 0, 5 5, 10 10)');
-- Answer: FALSE

-- The same, but with opposite vertex order:
SELECT ST_OrderingEquals('POLYGON(0 0, 10 10, 10 5, 0 0)',
                         'POLYGON(0 0, 10 5, 10 10, 0 0)');
-- Answer: FALSE

-- Different:
SELECT ST_OrderingEquals('LINESTRING(0 0 1, 0 0, 10 10)',
                         'LINESTRING(0 0, 0 0, 10 10)');
-- Answer: FALSE

-- The same, but component POLYGONs are listed in opposite order:
SELECT ST_OrderingEquals('MULTIPOLYGON(((0 0, 10 10, 10 5, 0 0)),
                                       ((1 1, 2 2, 2 1, 1 1)))',
                         'MULTIPOLYGON(((1 1, 2 2, 2 1, 1 1)),
                                       ((0 0, 10 10, 10 5, 0 0)))');
-- Answer: FALSE
See also