## 12.17.13 Spatial Convenience Functions 

FROM product; +-------------------------------+ | result | +-------------------------------+ | MULTIPOINT((28 -77)) | | MULTIPOINT((28 -77),(60 -24)) | | MULTIPOINT((60 -24),(28 -77)) | | MULTIPOINT((28 -77),(38 60)) | | MULTIPOINT((38 60),(60 -24)) | | MULTIPOINT((60 -24),(28 -77)) | +-------------------------------+ 

This function was added in MySQL 8.0.24. 

The functions in this section provide convenience operations on geometry values. 

Unless otherwise specified, functions in this section handle their geometry arguments as follows: 

•If any argument is NULL , the return value is NULL . 

•If any geometry argument is not a syntactically well-formed geometry, an ER_GIS_INVALID_DATA  error occurs. 

•If any geometry argument is a syntactically well-formed geometry in an undefined spatial reference system (SRS), an ER_SRS_NOT_FOUND  error occurs. 

•For functions that take multiple geometry arguments, if those arguments are not in the same SRS, an ER_GIS_DIFFERENT_SRIDS  error occurs. 

•Otherwise, the return value is non- NULL . 

These convenience functions are available: 

• ST_Distance_Sphere( g1 , g2  [, radius ]) 

Returns the mimimum spherical distance between Point  or MultiPoint  arguments on a sphere, in meters. (For general-purpose distance calculations, see the ST_Distance()  function.) The optional radius  argument should be given in meters. 

If both geometry parameters are valid Cartesian Point  or MultiPoint  values in SRID 0, the return value is shortest distance between the two geometries on a sphere with the provided radius. If omitted, the default radius is 6,370,986 meters, Point X and Y coordinates are interpreted as longitude and latitude, respectively, in degrees. 

If both geometry parameters are valid Point  or MultiPoint  values in a geographic spatial reference system (SRS), the return value is the shortest distance between the two geometries on a sphere with the provided radius. If omitted, the default radius is equal to the mean radius, defined as (2a+b)/3, where a is the semi-major axis and b is the semi-minor axis of the SRS. 

ST_Distance_Sphere()  handles its arguments as described in the introduction to this section, with these exceptions: 

•Supported geometry argument combinations are Point  and Point , or Point  and MultiPoint (in any argument order). If at least one of the geometries is neither Point  nor MultiPoint , and its SRID is 0, an ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS  error occurs. If at least one of the geometries is neither Point  nor MultiPoint , and its SRID refers to a geographic SRS, an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS  error occurs. If any geometry refers to a projected SRS, an ER_NOT_IMPLEMENTED_FOR_PROJECTED_SRS  error occurs. 

