ST_intersection

更新时间:
复制 MD 格式

Returns a geometry value representing the spatial intersection of two trajectory objects within a specified time range.

Syntax

geometry ST_intersection(trajectory traj1, trajectory traj2, tsrange range);
geometry ST_intersection(trajectory traj1, trajectory traj2, timestamp t1, timestamp t2);

Parameters

ParameterDescription
traj1Trajectory object 1.
traj2Trajectory object 2.
t1The start time of the time range.
t2The end time of the time range.
rangeThe time range, expressed as a PostgreSQL tsrange value.

Example

The following example returns the intersection geometry of the trajectories with IDs 1 and 2 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'
);