Skip to main content
The ST_DISTANCE function calculates the shortest distance, measured as a geodesic arc between two GEOGRAPHY objects, measured in meters. It models the earth as a perfect sphere with a fixed radius of 6,371,008 meters. If either input is empty, ST_DISTANCE will return NULL.

Syntax

Parameters

Return Type

ST_DISTANCE returns a value of type DOUBLE PRECISION.

Example

The following code example constructs two Points from their WKT representations: One at the Statue of Liberty in New York City, and one at the Big Ben in London. It then returns the shortest distance between them, as measured as a geodesic arc, in meters:

Rows: 1Execution time: 5.02ms