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
| Parameter | Description |
|---|---|
traj | The trajectory object. |
range | The time range, as a tsrange value. |
t1 | The start time. |
t2 | The end time. |
g | The 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;该文章对您有帮助吗?