ST_intersects

更新时间:
复制 MD 格式

Returns true if a trajectory object and the specified geometry object share at least one point in space during 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);

Parameters

ParameterDescription
trajThe trajectory object.
rangeThe time range, specified as a tsrange value.
t1The start time.
t2The end time.
gThe specified geometry object.

Use cases

Use this function for:

  • Geofence detection: determine whether a vehicle or asset entered a restricted zone during a shift

  • Route coverage analysis: check whether a delivery route crossed a specific district

Example

The following query checks whether each trajectory in traj_table intersected the line LINESTRING(0 0, 5 5, 9 9) 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;