WL#10999: ST_Distance_Sphere for geographic geometries

Affects: Server-8.0   —   Status: Complete

Currently, ST_Distance_Sphere expects its input to be X=longitude in degrees and Y=latitude in degrees, regardless of SRID. This made sense in 5.7 when MySQL didn't know anything about spatial reference systems. However, with the introduction of geography, it is not natural for geographic coordinates to be interpreted in any other way than the way they're specified in the SRS definition. E.g., a point specified in radians should be interpreted as in radians, not as degrees. Also, coordinates in projected SRSs should not be treated as degrees, since they're explicitly in meters.

This WL extends ST_Distance_Sphere to also accept parameters in geographic SRSs (still limited to points and multipoints). This way, ST_Distance_Sphere can be used as a performance optimization for geographical distance, if the user can accept less accurate results.

The WL also forbids the user from doing ST_Distance_Sphere on geometries in projected SRSs since those coordinates don't make sense on a sphere.

For geographic parameters, the radius of the sphere will default to the semi-major axis of the ellipsoid of the SRS of the parameters. The default value can be overridden by the third parameter to the function, just as it is today.