STS_GetStationaryPosition function
The STS_GetStationaryPosition function returns the stationary duration and position of an object.
Syntax
STS_GetStationaryPosition(
ts TimeSeries,
begin_time DATETIME YEAR TO FRACTION(5),
end_time DATETIME YEAR TO FRACTION(5),
geometry ST_Geometry)
returns STS_StationaryPosition_r
STS_GetStationaryPosition(
ts TimeSeries,
begin_time DATETIME YEAR TO FRACTION(5),
end_time DATETIME YEAR TO FRACTION(5))
returns STS_StationaryPosition_r
STS_GetStationaryPosition(
ts TimeSeries,
geometry ST_Geometry)
returns STS_StationaryPosition_r
- ts
- The time series value.
- begin_time (Optional)
- The start of the time range. NULL indicates the time stamp of the first element in the time series.
- end_time (Optional)
- The end of the time range. NULL indicates the time stamp of the last element in the time series.
- geometry (Optional)
- The region of interest. Can be an ST_Point, ST_MultiPoint, ST_LineString, ST_MultiLineString, ST_Polygon, or ST_MultiPolygon. Must use the SRID 4326.
Usage
Run the STS_GetStationaryPosition function to know where and for how long an object was stationary. If you include the geometry parameter, the results are limited to stationary objects in the region of interest. If you include a time range, the results are limited to the specified time range.
Returns
A ROW data type = The start time, end time, and location of the object. The ROW data type that has the following structure:
create row type STS_StationaryPosition_r(
begin_time DATETIME YEAR TO FRACTION(5),
end_time DATETIME YEAR TO FRACTION(5),
position ST_Point);
NULL = Nothing found.
An exception = An error.
Example
The following query returns the duration and the location of when vehicle 1002 was stationary between the times of 2015-06-14 12:34:25.00000 and 2015-06-14 12:43:23.00000:
SELECT r.begin_time,r.end_time,r.position::lvarchar
FROM TABLE(STS_GetStationaryPosition(
(SELECT ts_track FROM t_vehicle WHERE modid = 1002),
'2015-06-14 12:34:25.00000','2015-06-14 12:43:23.00000', NULL))
AS t(r);
begin_time 2015-06-14 12:34:25.00000
end_time 2015-06-14 12:43:23.00000
(expression) 4326 POINT (-78.704498 43.919695)
1 row(s) retrieved.