Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (Français) » SQL Anywhere Server - Spatial Data Support » Getting started with spatial data » Introduction to spatial data


Comparing geometries using ST_Equals and ST_OrderingEquals

There are two methods you can use to test whether a geometry is equal to another geometry: ST_Equals, and ST_OrderingEquals. These methods perform the comparison differently, and return a different result.

  • ST_Equals   The order in which points are specified does not matter, and point comparison takes tolerance into account. Geometries are also considered equal if they occupy the same space, within tolerance. This means that if two linestrings occupy the same space, yet one is defined with more points, they are still considered equal.

  • ST_OrderingEquals   With ST_OrderingEquals, the order in which points are specified matters, and point comparisons do not take tolerance into account. That is, points must be exactly the same, including being specified in the exact same order, for the geometries to be considered equal.

To illustrate the difference in results when comparisons are made using ST_Equals versus ST_OrderingEquals, consider the following lines. ST_Equals considers them all equal (assuming line C is within tolerance). However, ST_OrderingEquals does not consider any of them equal.

Line A and B have the same two end points, but they are specified in different order. Line C looks like line A, but at a slight angle. Line D has three points defined for the line, but consumes the same space as lines A and B.
 How SQL Anywhere performs comparisons of geometries