ST_distanceWithin

更新时间:
复制 MD 格式

Returns true if the distance between two trajectory objects is within the reference distance during the specified time range.

Syntax

boolean ST_distanceWithin(trajectory traj1, trajectory traj2, tsrange range, float8 d);
boolean ST_distanceWithin(trajectory traj1, trajectory traj2, timestamp t1, timestamp t2, float8 d);

Parameters

ParameterDescription
traj1, traj2The trajectory objects to compare.
rangeThe time range, as a tsrange value.
t1The start of the time range, as a timestamp.
t2The end of the time range, as a timestamp.
dThe reference distance, as a float8.

Examples

The following example checks whether two moving objects in traj_table came within 100 units of each other between 13:00 and 14:00 on January 1, 2010.

Select ST_distanceWithin((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', 100);