Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Tests if a geometry is identical to another geometry.
The other geometry value that is to be compared to the geometry-expression.
Returns 1 if the two geometry values are exactly equal, otherwise 0.
Tests if an ST_Geometry value is identical to another ST_Geometry value. The two geometries must contain the same hierarchy of objects with the exact same points in the same order to be considered equal under ST_OrderingEquals.
The ST_OrderingEquals method differs from ST_Equals in that it considers the orientation of curves. Two curves can contain exactly the same points but in opposite orders. These two curves are considered equal with ST_Equals but unequal with ST_OrderingEquals. Additionally, ST_OrderingEquals requires that each point in both geometries is exactly equal, not just equal within the tolerance-distance specified by the spatial reference system.
The ST_OrderingEquals method defines the semantics used for comparison predicates (= and <>), IN list predicates, DISTINCT, and GROUP BY. If you wish to compare if two spatial values are spatially equal (contain the same set of points in set), you can use the ST_Equals method.
The following example returns the result 16. The Shape corresponding to ShapeID the result 16 contains the exact same points in the exact same order as the specified polygon.
SELECT ShapeID FROM SpatialShapes WHERE Shape.ST_OrderingEquals( NEW ST_Polygon( 'Polygon ((0 0, 2 0, 1 2, 0 0))' ) ) = 1
The following returns the result 1 because the two linestrings contain exactly the same points in the same order.
SELECT NEW ST_LineString('LineString(0 0, 1 0)') .ST_OrderingEquals(NEW ST_LineString('LineString(0 0, 1 0)'))
The following returns the result 0 because the two linestrings are defined in different orders (even though the two linestrings are spatially equal (ST_Equals is 1)).
SELECT NEW ST_LineString('LineString(0 0, 1 0)') .ST_OrderingEquals(NEW ST_LineString('LineString(1 0, 0 0)'))