Tests if an ST_Geometry value is spatially equal to another ST_Geometry value.
 Syntax
 Syntaxgeometry-expression.ST_Equals(geo2) Parameters
 Parameters| Name | Type | Description | 
|---|---|---|
| geo2 | ST_Geometry | The other geometry value that is to be compared to the geometry-expression. | 
 Returns
 ReturnsBIT Returns 1 if the two geometry values are spatially equal, otherwise 0.
 Remarks
 RemarksTests 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 the 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 be 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 Comparing geometries using ST_Equals and ST_OrderingEquals.
ST_Equals may be limited by the resolution of the spatial reference system or the accuracy of the data.
If the geometry-expression contains circular strings, then these are interpolated to line strings.
 See also
 See also Standards and compatibility
 Standards and compatibilitySQL/MM (ISO/IEC 13249-3: 2006) 5.1.24
 Example
 ExampleThe 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).
               
| SELECT NEW ST_LineString( 'LineString( 0 0, 0.333333 1, 1 3 )' )
        .ST_Equals( NEW ST_LineString( 'LineString( 1 3, 0 0 )' ) ) | 
|  | Discuss this page in DocCommentXchange.
                   | Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |