12.16.9.1 Spatial Relation Functions That Use Object Shapes (original) (raw)

12.16.9.1 Spatial Relation Functions That Use Object Shapes

The OpenGIS specification defines the following functions to test the relationship between two geometry values_g1_ and g2, using precise object shapes. The return values 1 and 0 indicate true and false, respectively, except forST_Distance() andDistance(), which return distance values.

These functions support all argument type combinations except those that are inapplicable according to the Open Geospatial Consortium specification.

mysql> SET @g1 = Point(1,1);  
mysql> SET @g2 = Point(2,2);  
mysql> SELECT ST_Distance(@g1, @g2);  
+-----------------------+  
| ST_Distance(@g1, @g2) |  
+-----------------------+  
|    1.4142135623730951 |  
+-----------------------+  

ST_Distance() andDistance() are synonyms.

mysql> SET @g1 = Point(1,1), @g2 = Point(2,2);  
mysql> SELECT ST_Equals(@g1, @g1), ST_Equals(@g1, @g2);  
+---------------------+---------------------+  
| ST_Equals(@g1, @g1) | ST_Equals(@g1, @g2) |  
+---------------------+---------------------+  
|                   1 |                   0 |  
+---------------------+---------------------+