This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-14. For the latest, interactive version please visit https://mariadb.com/kb/.

ST_DISTANCE_SPHERE

MariaDB starting with 10.5.10

ST_DISTANCE_SPHERE was introduced in MariaDB 10.2.38, MariaDB 10.3.29, MariaDB 10.4.19 and MariaDB 10.5.10.

Syntax

ST_DISTANCE_SPHERE(g1,g2,[r])

Description

Returns the spherical distance between two geometries (point or multipoint) on a sphere with the optional radius r (default is the Earth radius if r is not specified), or NULL if not given valid inputs.

Example

set @zenica   = ST_GeomFromText('POINT(17.907743 44.203438)');
set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');
SELECT ST_Distance_Sphere(@zenica, @sarajevo);
55878.59337591705
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.