15.10 - ST_3DDistance - Teradata Database

Teradata Database SQL Geospatial Types

Teradata Database
Programming Reference

Returns the distance between two ST_Geometry values. ST_3DDistance considers z coordinate values, if they exist in the geometries passed to it.


Argument …

Specifies …


the other ST_Geometry value.

Returns a FLOAT value. The distance units are those of the two input geometries.

Returns 0 if the two geometries intersect.

Returns NULL if the ageometry argument is NULL.

ST_Point, ST_MultiPoint, ST_LineString, and ST_MultiLineString
To be valid with ST_3DDistance, these shapes must include z coordinates.

  • Both geometries must include z coordinates.
  • Both geometries must use the same spatial reference system (have the same SRS ID).
  • If a geospatial index is defined on the geospatial data column to which this method is applied, the index will only be used if method appears in the WHERE clause of a query such that the distance between the geometries is less than or equal to a constant. For example:
  • ... WHERE geom.ST_3DDistance(otherGeom) < 10
    ... WHERE 10 >= geom.ST_3DDistance(otherGeom)
    INSERT INTO sample_shapes VALUES(1,'Point(10 20 30)');
    INSERT INTO sample_shapes VALUES(2,
     'MultiPoint((10 20 30),(40 50 60), (70 80 80))');
    INSERT INTO sample_shapes VALUES(3,
     'Linestring(10 20 30,40 50 60, 70 80 80)');
    INSERT INTO sample_shapes VALUES(4,
     'MultiLinestring((10 20 30,40 50 60), (70 80 80, 90 100 110))');
    SELECT skey
    FROM sample_shapes
    WHERE shape.ST_3DDistance('POINT(10 20 30)') < 1E0;