ST_distanceWithin

更新时间:
复制 MD 格式

Returns true if the distance between a trajectory object and a geometry object is within the specified distance at any point during the given time range.

Syntax

boolean ST_distanceWithin(trajectory traj, tsrange range, geometry g, float8 d);
boolean ST_distanceWithin(trajectory traj, timestamp t1, timestamp t2, geometry g, float8 d);

Parameters

ParameterDescription
trajThe trajectory object.
t1The start time.
t2The end time.
rangeThe time range, specified as a tsrange value.
gThe geometry object to test against.
dThe reference distance.

Return value

Returns boolean.

Example

Check whether a trajectory passed within 10 units of a line segment between 13:00 and 14:00 on January 1, 2010:

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