Some functions in this section permit a unit argument that specifies the length unit for the return value. Unless otherwise specified, functions handle their unit argument as follows: 

•A unit is supported if it is found in the INFORMATION_SCHEMA ST_UNITS_OF_MEASURE  table. See Section 26.3.37, “The INFORMATION_SCHEMA ST_UNITS_OF_MEASURE Table” . 

•If a unit is specified but not supported by MySQL, an ER_UNIT_NOT_FOUND  error occurs. 

•If a supported linear unit is specified and the SRID is 0, an ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT  error occurs. 

•If a supported linear unit is specified and the SRID is not 0, the result is in that unit. 

•If a unit is not specified, the result is in the unit of the SRS of the geometries, whether Cartesian or geographic. Currently, all MySQL SRSs are expressed in meters. 

These object-shape functions are available for testing geometry relationships: 

• ST_Contains( g1 , g2 ) 

Returns 1 or 0 to indicate whether g1  completely contains g2 . This tests the opposite relationship as ST_Within() . 

ST_Contains()  handles its arguments as described in the introduction to this section. 

• ST_Crosses( g1 , g2 ) 

Two geometries spatially cross  if their spatial relation has the following properties: 

•Unless g1  and g2  are both of dimension 1: g1  crosses g2  if the interior of g2  has points in common with the interior of g1 , but g2  does not cover the entire interior of g1 . 

•If both g1  and g2  are of dimension 1: If the lines cross each other in a finite number of points (that is, no common line segments, only single points in common). 

This function returns 1 or 0 to indicate whether g1  spatially crosses g2 . 

ST_Crosses()  handles its arguments as described in the introduction to this section except that the return value is NULL  for these additional conditions: 

• g1  is of dimension 2 ( Polygon  or MultiPolygon ). 

• g2  is of dimension 1 ( Point  or MultiPoint ). 

• ST_Disjoint( g1 , g2 ) 

Returns 1 or 0 to indicate whether g1  is spatially disjoint from (does not intersect) g2 . 

ST_Disjoint()  handles its arguments as described in the introduction to this section. 

• ST_Distance( g1 , g2  [, unit ]) 

Returns the distance between g1  and g2 , measured in the length unit of the spatial reference system (SRS) of the geometry arguments, or in the unit of the optional unit  argument if that is specified. 

This function processes geometry collections by returning the shortest distance among all combinations of the components of the two geometry arguments. 

