ST_durationWithin

更新时间:
复制 MD 格式

Returns true if two trajectory objects intersect at the same spatial point within the specified time range and the time difference between those intersections is within the reference interval.

Syntax

boolean ST_durationWithin(trajectory traj1, trajectory traj2, tsrange range, interval i);
boolean ST_durationWithin(trajectory traj1, trajectory traj2, timestamp t1, timestamp t2, interval i);

Parameters

Parameter Description
traj The trajectory object.
range The time range, specified as a tsrange value.
t1 The start time of the time range.
t2 The end time of the time range.
i The reference interval.

Usage notes

If the two trajectory objects intersect at the same spatial point multiple times within the time range, the function returns true as long as any one of those intersections has a time difference within the reference interval.

Examples

Select ST_durationWithin((Select traj from traj_table where id=1), (Select traj from traj_table where id=2), '2010-1-1 13:00:00', '2010-1-1 14:00:00', INTERVAL '30s');

This query checks whether trajectories with id=1 and id=2 intersect at the same spatial point between 13:00 and 14:00 on January 1, 2010, with a time difference of no more than 30 seconds.