15.10 - SpheroidalDistance - Teradata Database

Teradata Database SQL Geospatial Types

Teradata Database
Programming Reference

Returns the distance, in meters, between two spherical coordinates.

See also “ST_SpheroidalDistance” on page 111.


Argument …

Specifies …

lat1, lon1

the latitude and longitude of the first point. The data type of both is FLOAT.


the latitude and longitude of the second point.

The data type of lat2 and lon2 is FLOAT.


an optional FLOAT for the length in meters of the semimajor axis of the spheroid.


an optional FLOAT for the inverse flattening ratio of the spheroid.

Returns a FLOAT value.

For the distance calculation, the planet is modeled as a spheroid.

If you do not pass in values for the semimajor and invf 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 SYSSPATIAL.SpheroidalDistance UDF may fail to converge, generating a Teradata Database error. For these distance calculations use instead the SYSSPATIAL.SphericalDistance UDF.

The following two examples show how to use the SpheroidalDistance function to get the spheroidal distance between Madison (-89.39, 43.09) and Chicago (-87.65, 41.90):

   SELECT SYSSPATIAL.SpheroidalDistance( -89.39, 43.09, -87.65, 41.90,
                                         6378137, 298.257223563);
   SELECT SYSSPATIAL.SpheroidalDistance( -89.39, 43.09, -87.65, 41.90);