This topic describes the ST_DistanceSphere function. This function calculates the minimum distance between two geometry objects. The minimum distance is represented by a latitude and a longitude and is measured in meters.

Syntax

float  ST_DistanceSphere(geometry  geomlonlatA , geometry  geomlonlatB);

Parameters

Parameter Description
geomlonlatA The first geometry object that you want to specify.
geomlonlatB The second geometry object that you want to specify.

Description

  • This function uses the information about the ellipsoid that is defined by the spatial reference identifier (SRID) in the source data.
  • This function calculates the minimum distance between two geometry objects at a faster speed but a lower accuracy than the ST_DistanceSpheroid function.

Examples

SELECT ST_DistanceSphere(ST_GeomFromText('POINT (120 36)',4326), ST_GeomFromText('POINT (116 40)',4326));
 st_distancesphere
-------------------
   566139.31447502
(1 row)