Tests if an ST_Geometry value is equal to another ST_Geometry value.
The test for spatial equality is performed by first comparing the bounding rectangles of the two geometries. If they are
not equal within tolerance, the two geometries are considered not to be equal, and 0 is returned. Otherwise, the database
server returns 1 if geometry-expression.ST_SymDifference( geo2 ) is the empty set, otherwise it returns 0.
Note that the SQL/MM standard defines ST_Equals only in terms of ST_SymDifference, without an additional bounding box comparison.
There are some geometries that generate an empty result with ST_SymDifference while their bounding boxes are not equal. These
geometries would be considered equal by the SQL/MM standard but are not considered equal by SQL Anywhere. This difference
can arise if one or both geometries contain spikes or punctures.
Two geometry values can be considered equal even though they have different representations. For example, two linestrings
may have opposite orientations but contain the same set of points in space. These two linestrings are considered equal by
ST_Equals but not by ST_OrderingEquals. See How spatial comparisons work.
ST_Equals may be limited by the resolution of the spatial reference system or the accuracy of the data.
If the geometry-expression contains circularstrings, then these are interpolated to line strings.
The following example returns the result 16. The Shape corresponding to ShapeID the result 16 contains the same points but in a different order as the specified polygon.
SELECT ShapeID FROM SpatialShapes
WHERE Shape.ST_Equals( NEW ST_Polygon( 'Polygon ((2 0, 1 2, 0 0, 2 0))' ) ) = 1
The following example returns the result 1, indicating that the two linestrings are equal even though they contain a different number of points specified in a different
order, and the intermediate point is not exactly on the line. The intermediate point is about 3.33e-7 away from the line with
only two points, but that distance less than the tolerance 1e-6 for the "Default" spatial reference system (SRID 0).