ST_subTrajectory

Updated at:

Returns the sub-trajectory of a trajectory object within the specified time range.

Syntax

trajectory ST_subTrajectory(trajectory traj, timestamp starttime, timestamp endtime);
trajectory ST_subTrajectory(trajectory traj, tsrange range);

Parameters

ParameterTypeDescription
trajtrajectoryThe trajectory object.
starttimetimestampThe start time of the sub-trajectory.
endtimetimestampThe end time of the sub-trajectory.
rangetsrangeThe time range of the sub-trajectory.

Return value: A trajectory object representing the portion of traj within the specified time range.

Examples

Extract the portion of a trajectory between two timestamps:

Select ST_subTrajectory(traj, '2010-1-11 02:45:30', '2010-1-11 03:00:00') FROM traj_table;