ST_nearestApproachDistance

更新时间:
复制 MD 格式

Returns the nearest distance between two trajectory objects within a specified time range.

Syntax

float8 ST_nearestApproachDistance(trajectory traj, trajectory traj2);
float8 ST_nearestApproachDistance(trajectory traj, trajectory traj2, tsrange range);
float8 ST_nearestApproachDistance(trajectory traj, trajectory traj2, timestamp t1, timestamp t2);

Parameters

ParameterDescription
traj1The first trajectory object.
traj2The second trajectory object.
rangeThe time range, specified as a tsrange value.
t1The start of the time range.
t2The end of the time range.

Return value

Returns a float8 value representing the nearest distance between the two trajectory objects.

Examples

The following example calculates the nearest approach distance between the trajectories of objects with IDs 1 and 2 between 13:00 and 14:00 on January 1, 2010.

SELECT ST_nearestApproachDistance(
  (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'
);