STS_SubtrackUpdate function

The STS_SubtrackUpdate function indexes spatiotemporal data for the specified object.

Syntax

STS_SubtrackUpdate(
                ts           TimeSeries,
                begin_time   DATETIME YEAR TO FRACTION(5) DEFAULT NULL,
                end_time     DATETIME YEAR TO FRACTION(5) DEFAULT NULL,
                flags        INTEGER DEFAULT 1)
returns BIGINT
ts
The time series value.
begin_time
The time to begin indexing. Default is NULL, which indicates the value of the ts_data_first_timestamp parameter.
end_time
The time to end indexing. Default is NULL, which indicates the time that is specified by the ts_data_lag_to_current parameter.
flags
The scope of the indexing:
1 = Default. Incrementally build the trajectories for the object for the time period.
2 = Rebuild all trajectories for the object for the time period.

Usage

Run the STS_SubtrackUpdate function to build the trajectories for the specified object for the specified time period. You must have created the subtrack table for the time series that contains the object by running the STS_SubtrackCreate function.

The indexing time range is set by the values of the ts_data_first_timestamp and ts_data_lag_to_current parameters, as set in the STS_SubtrackCreate function, or as reset by the STS_SubtrackAlterFirstTimeStamp and STS_SubtrackAlterLagToCurrent functions.

If you set the flags parameter to 1, indexing begins after the end time of the latest entry for the time series object in the subtrack table. If the subtrack table is empty, indexing begins from the value of the ts_data_first_timestamp parameter and continues until the time that is specified by the ts_data_lag_to_current parameter.

If you set the flags parameter to 2, any existing data in the subtrack table for the time series object is deleted. Every time series element for the object is indexed from the value of the ts_data_first_timestamp parameter until the time that is specified by the ts_data_lag_to_current parameter. Rebuilding all trajectories can be useful if you need to remove or update existing data or add data that is earlier than the latest time stamp.

Returns

An integer = The number of time series values processed.

An exception = An error.

Example: Build trajectories for a set of objects

The following SPL code fragment runs an incremental update that updates the trajectories for time series values where the value of the modid column is like 100%:

DECLARE ts timeseries(rt_track);
       FOREACH ts_value FOR SELECT ts_track INTO ts_track 
           FROM t_vehicle WHERE modid LIKE '100%'
           EXEUCTE FUNCTION STS_SubtrackUpdate('ts_vehicle_subtrack', 
                             NULL, NULL, 1);
  END FOREACH;

Example: Build trajectories for a single object

The following SPL code fragment builds all trajectories for the entire history of the object that is named 1001:

DECLARE ts timeseries(rt_track);
       FOREACH ts_value FOR SELECT ts_track INTO ts_track 
          FROM t_vehicle WHERE modid = '1001'
          EXEUCTE FUNCTION STS_SubtrackUpdate('ts_vehicle_subtrack', 
                            NULL, NULL, 2);
  END FOREACH;

Example: Build trajectories for a month

The following SPL code fragment builds all trajectories for the object 1001 for the month of October 2015:

DECLARE ts timeseries(rt_track);
       FOREACH ts_value FOR SELECT ts_track INTO ts_track 
          FROM t_vehicle WHERE modid = '1001'
          EXEUCTE FUNCTION STS_SubtrackUpdate('ts_vehicle_subtrack', 
               '2015-10-01 00:00:00.0000'::datetime year to fraction(5), 
               '2015-11-01 00:00:00.0000'::datetime year to fraction(5), 2);
  END FOREACH;