15.10 - SpeedN - Teradata Database

Teradata Database SQL Geospatial Types

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

Returns the approximate speed at a specified point (SpeedN(index INTEGER)) or between two points (SpeedN(iBegin INTEGER, iEnd INTEGER)) for a GeoSequence type.

 

Argument …

Specifies …

index

an INTEGER for the index of the point within the GeoSequence type, where the index of the first point is 1.

iBegin

an INTEGER for the index of the starting point for which to calculate the speed, where the index of the first point in a GeoSequence type is 1.

iEnd

an INTEGER for the index of the ending point for which to calculate the speed, where the index of the first point in a GeoSequence is 1.

Returns a FLOAT value.

 

IF you pass in …

THEN …

iBegin and iEnd

the speed is calculated as the distance between the two points (along the LineString) divided by the time between them.

index

if the point is:

  • the first point, the distance between the first and second points is divided by the time between them.
  • the last point, the distance between the second to the last and last points is divided by the time between them.
  • any other point, the distance between the previous point and the next point (along the LineString) is divided by the time difference between the previous point and the next point.
  • The units used for distance are the same units that are used by the coordinate system for the GeoSequence value, and the time units are in hours.

    GeoSequence

    CREATE TABLE sample_shapes(skey INTEGER, shape ST_Geometry);
     
    INSERT INTO sample_shapes ( 100,'GeoSequence( (10 10, 15 15, -2 0) ,(2007-03-14 01:35:00, 2007-03-14 01:35:05, 2007-03-14 01:35:08),(1222, 1223, 1224),(2, 12.1, 3.14159, 2.78128, -10, -11, 100.1))' );
     
       SELECT skey
       FROM sample_shapes
       WHERE ((shape.SpeedN(2,3)) < 3000e1)
       ORDER BY skey;