ST_nearestApproachPoint

更新时间:
复制 MD 格式

Returns the point on a trajectory that is closest to a given geometry object, within a specified time range.

Syntax

geometry ST_nearestApproachPoint(trajectory traj, tsrange range, geometry g);
geometry ST_nearestApproachPoint(trajectory traj, timestamp t1, timestamp t2, geometry g);

Two overloads are available: one accepts a tsrange value, and the other accepts explicit start and end timestamps.

Parameters

ParameterDescription
trajThe trajectory object.
rangeThe time range, as a tsrange value.
t1The start time.
t2The end time.
gThe geometry object to measure distance from.

Return value

Returns a geometry value representing the nearest point on the trajectory to the specified geometry object within the given time range.

Example

The following example finds the point on the trajectory stored in the traj column of traj_table that is closest to the line LINESTRING(0 0, 5 5, 9 9), within the time range from 13:00 to 14:00 on January 1, 2010.

Select ST_nearestApproachPoint(traj, '2010-1-1 13:00:00', '2010-1-1 14:00:00', 'LINESTRING(0 0, 5 5, 9 9)'::geometry) from traj_table;