ST_timeAtDistance

更新时间:
复制 MD 格式

Returns the timestamps at which a trajectory reaches each spatial point located at a given distance from the start point.

Because a trajectory can cross the same distance threshold multiple times—for example, when a vehicle loops back—the function returns a timestamp[] array. Each element corresponds to one crossing point at that distance.

Syntax

timestamp[] ST_timeAtDistance(trajectory traj, float8 d)

Parameters

ParameterTypeDescription
trajtrajectoryThe trajectory object.
dfloat8The distance of movement.

Example

The following query returns the timestamps at which the trajectory in traj_table reaches 100 units from the start point. If the trajectory passes through that distance multiple times, the result contains multiple timestamps.

SELECT ST_timeAtDistance(traj, 100) FROM traj_table;