Computes the geometric intersection of two trajectory objects within a specified time range and returns the result as a geometry value.
Syntax
geometry ST_intersection(trajectory traj1, trajectory traj2, tsrange range);
geometry ST_intersection(trajectory traj1, trajectory traj2, timestamp t1, timestamp t2);Parameters
| Parameter | Type | Description |
|---|---|---|
traj1 | trajectory | Trajectory object 1. |
traj2 | trajectory | Trajectory object 2. |
range | tsrange | The time range. |
t1 | timestamp | The start time. |
t2 | timestamp | The end time. |
Return type: geometry
Example
The following example retrieves two trajectory objects from traj_table and returns their geometric intersection between 13:00 and 14:00 on January 1, 2010.
SELECT ST_intersection(
(SELECT traj FROM traj_table WHERE id = 1),
(SELECT traj FROM traj_table WHERE id = 2),
'2010-1-1 13:00:00',
'2010-1-1 14:00:00'
);