STS_GetPosition function

The STS_GetPosition function returns the position of an object at a specified time.

Syntax

STS_GetPosition(
                ts         TimeSeries,
                tstamp     DATETIME YEAR TO FRACTION(5))
returns ST_Point
ts
The time series value.
tstamp
The time stamp to query.

Usage

Run the STS_GetPosition function to find where a moving object was at a specific time.

Identify which object to track in the WHERE clause of the query.

The following illustration shows the trajectory of a vehicle and the position of (-78.752717 43.922478) at 2014-01-08 00:00:00.

Figure 1: The path of a moving vehicle

At the time 2014-01-08 00:00:00, the position of the vehicle is (-78.752717 43.922478), with the SRID of 4326.

Returns

An ST_Point = The location of the object.

NULL = Nothing found.

Example

The following query returns the position of the vehicle 1001 at 2014-06-07 20:51:35:

SELECT STS_GetPosition(ts_track, '2014-06-07 20:51:35') 
        FROM t_vehicle 
        WHERE modid = 1001; 

(expression)  
    4326 POINT (-79.099042 43.81251) 
1 row(s) retrieved.