ST_intersects

更新时间:
复制 MD 格式

Returns true if a trajectory object and a geometry object have at least one point in common within the specified time range.

Syntax

boolean ST_intersects(trajectory traj, tsrange range, geometry g);
boolean ST_intersects(trajectory traj, timestamp t1, timestamp t2, geometry g);

Use the first overload to pass a tsrange value directly. Use the second overload when you have separate start and end timestamps.

Parameters

ParameterDescription
trajThe trajectory object.
rangeThe time range, expressed as a tsrange value.
t1The start time, expressed as a timestamp value.
t2The end time, expressed as a timestamp value.
gThe geometry object to test intersection against.

Returns

booleantrue if the trajectory intersects the geometry within the time range.

Example

Check whether trajectories in traj_table intersect a LINESTRING geometry between 13:00 and 14:00 on January 1, 2010:

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