ArcGIS Server Banner

ST_OrderingEquals

ST_OrderingEquals

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

ST_OrderingEquals compares two 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

Oracle

sde.st_orderingequals (g1 sde.st_geometry, g2 sde.st_geometry)

PostgreSQL

st_orderingequals (g1 st_geometry, g2 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.

Oracle

CREATE TABLE linestring_test (
lid integer,
ln1 sde.st_linestring,
ln2 sde.st_geometry);

PostgreSQL

CREATE TABLE linestring_test (
lid integer,
ln1 st_linestring,
ln2 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,
st_linestring ('linestring (10.01 20.02, 21.50 12.10)', 0),
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, st_equals (ln1, ln2) AS Equals, st_orderingequals (ln1, ln2) AS OrderingEquals
FROM linestring_test;

lid equals     orderingequals

1   t          t

See Also

  • An overview of SQL functions used with ST_Geometry types