STS_GetLastPosition function

The STS_GetLastPosition function returns the location of the most recent time series element.

Syntax

STS_GetLastPosition(
                ts   TimeSeries )
returns ST_Point
ts
The time series value.

Usage

Run the STS_GetLastPosition function to find the last location of the object.

Returns

An ST_Point = The last position of the object.

NULL = Nothing found.

Example: Find the last position of a vehicle

The following statement returns the last position of the vehicle 1001:

SELECT STS_GetLastPosition(ts_track) 
        FROM t_vehicle 
        WHERE modid = 1001; 

(expression)  
      4326 POINT (-78.753285 43.922345) 
1 row(s) retrieved.

Example: Find the last positions of all vehicles

The following statement returns the last position of all vehicles in the table:

SELECT modid, STS_GetLastPosition(ts_track) 
       FROM t_vehicle; 

modid         1001
(expression)  4326 POINT (-78.753285 43.922345) 
modid         1002
(expression)  4326 POINT (-78.704708 43.919647) 
2 row(s) retrieved.