Returns true if the distance between a trajectory object within the specified time range and the specified geometry object is within the reference distance.
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
| Parameter | Description |
|---|---|
traj | The trajectory object. |
range | The time range, specified as a tsrange value. |
t1 | The start time. |
t2 | The end time. |
g | The geometry object to test against. |
d | The reference distance. |
Example
The following example checks whether the trajectory in traj_table passed within a distance of 10 of the line LINESTRING(0 0, 5 5, 9 9) between 13:00 and 14:00 on January 1, 2010.
SELECT ST_distanceWithin(
traj,
'2010-01-01 13:00:00',
'2010-01-01 14:00:00',
'LINESTRING(0 0, 5 5, 9 9)'::geometry,
10
)
FROM traj_table;该文章对您有帮助吗?