ST_nearestApproachDistance

更新时间:
复制 MD 格式

Returns the nearest approach distance between a trajectory object and a geometry object within a specified time range.

Syntax

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

Parameters

ParameterTypeDescription
trajtrajectoryThe trajectory object to evaluate.
rangetsrangeThe time range.
t1timestampThe start time.
t2timestampThe end time.
ggeometryThe geometry object to measure distance from.

Example

The following query returns the nearest approach distance between the trajectory in each row of traj_table and the line LINESTRING(0 0, 5 5, 9 9), considering only the portion of the trajectory between 13:00 and 14:00 on January 1, 2010.

SELECT ST_nearestApproachDistance(
    traj,
    '2010-1-1 13:00:00',
    '2010-1-1 14:00:00',
    'LINESTRING(0 0, 5 5, 9 9)'::geometry
)
FROM traj_table;