ST_OrderingEquals
Definition
ST_OrderingEquals compares two ST_Geometries and returns 1 (Oracle) or t (PostgreSQL) if the geometries are equal and the coordinates are in the same order; otherwise, it returns 0 (Oracle) or f (PostgreSQL).
Syntax
sde.st_orderingequals (g1 sde.st_geometry, g2 sde.st_geometry)
Return type
Integer (Boolean)
Example
The following CREATE TABLE statement creates the LINESTRING_TEST table, which has two ST_LineString columns, ln1 and ln2.
CREATE TABLE linestring_test ( lid integer, ln1 sde.st_linestring, ln2 sde.st_geometry);
The following INSERT statement inserts two ST_LineString values into ln1 and ln2 that are equal and have the same coordinate ordering.
Oracle
INSERT INTO LINESTRING_TEST VALUES ( 1, sde.st_linefromtext ('linestring (10.01 20.02, 21.50 12.10)', 0), sde.st_linefromtext ('linestring (10.01 20.02, 21.50 12.10)', 0) );
PostgreSQL
INSERT INTO linestring_test VALUES ( 1, sde.st_linestring ('linestring (10.01 20.02, 21.50 12.10)', 0), sde.st_linestring ('linestring (10.01 20.02, 21.50 12.10)', 0) );
The following SELECT statement and corresponding result set shows how the ST_Equals function returns 1 (TRUE) regardless of the order of the coordinates. The ST_OrderingEquals function returns 0 (FALSE) if the geometries are not both equal and have the same coordinate ordering.
Oracle
SELECT lid, sde.st_equals (ln1, ln2) Equals, sde.st_orderingequals (ln1, ln2) OrderingEquals FROM LINESTRING_TEST; lid Equals OrderingEquals 1 1 1
PostgreSQL
SELECT lid, sde.st_equals (ln1, ln2) AS Equals, sde.st_orderingequals (ln1, ln2) AS OrderingEquals FROM linestring_test; lid equals orderingequals 1 t t