Mysql – ST_Distance_Spheroid does not exist

MySQLmysql-5.7spatial

I've try use MySql function ST_Distance_Spheroid for calculating distance but got following error :

ST_Distance_Spheroid does not exist.

Is something missing?

Best Answer

ST_Distance_Sphere() is special optimization on a sphere. If you want to calculate using an spheroid just use ST_Distance(). From the docs on ST_Distance()

ST_Distance() detects arguments in a geographic (ellipsoidal) spatial reference system and returns the geodetic distance on the ellipsoid. The only permitted geographic argument types are Point and Point, or Point and MultiPoint (in any argument order). If called with other geometry type argument combinations in a geographic SRS, an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS error occurs.

An ellipsoid is a spheroid where two axes have the same length.