15.10 - ST_SphericalDistance - Teradata Database

Teradata Database SQL Geospatial Types

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1181-151K

Returns the spherical distance between two spherical coordinates on the planet using the Haversine Formula. Both coordinates must be specified as ST_Point values.

 

Argument …

Specifies …

apoint

an ST_Geometry for the other spherical coordinate.

Returns a FLOAT.

ST_Point

   CREATE TABLE sample_points1 (skey1 INTEGER, point1 ST_Geometry);
   CREATE TABLE sample_points2 (skey2 INTEGER, point2 ST_Geometry);
 
   INSERT INTO sample_points1 VALUES (101, 'POINT(10 20)');
   INSERT INTO sample_points1 VALUES (102, 'POINT(10 50)');
 
   INSERT INTO sample_points2 VALUES (1001, 'POINT(20 30)');
   INSERT INTO sample_points2 VALUES (1002, 'POINT(20 40)');
 
   SELECT skey1, skey2, point1.ST_SphericalDistance(point2)
   FROM sample_points1, sample_points2
   ORDER BY skey1;