Returns the distance, in meters, between two spherical coordinates.
Argument … |
Specifies … |
apoint |
an ST_Geometry for the other coordinate. |
semimajor |
an optional FLOAT value for the length in meters of the semimajor axis of the spheroid. |
invflattening |
an optional FLOAT value for the inverse flattening ratio of the spheroid. |
Returns a FLOAT.
ST_Point
For the distance calculation, the planet is modeled as a spheroid.
If you do not pass in values for the semimajor and invflattening arguments, the computation uses the semimajor axis and the inverse flattening ratio from the World Geodetic System, WGS84. A value of 6,378,137.0 meters is used for the semimajor axis, and a value of 298.257223563 is used for the inverse flattening ratio.
Distance calculations between antipodal or nearly antipodal points using the ST_SpheroidalDistance method may fail to converge, generating a Teradata Database error. For these distance calculations use instead the ST_SphericalDistance method.
The following two examples show how to use the ST_SpheroidalDistance method to get the spheroidal distance between Madison (-89.39, 43.09) and Chicago (-87.65, 41.90):
CREATE TABLE sample_points1 (skey1 INTEGER, point1 ST_Geometry);
INSERT INTO sample_points1 VALUES (101, 'POINT(-89.39 43.09)');
SELECT point1.ST_SpheroidalDistance(
new ST_Geometry(
'ST_POINT(-87.65 41.90)'), 6378137, 298.257223563)
FROM sample_points1;
SELECT point1.ST_SpheroidalDistance(
new ST_Geometry('POINT(-87.65 41.90)') )
FROM sample_points1;