STS_TrajectoryCross function

The STS_TrajectoryCross function indicates whether the trajectory of a specified object crosses the specified region during the specified time range.

Syntax

STS_TrajectoryCross(
                    ts           TimeSeries,
                    begin_time   DATETIME YEAR TO FRACTION(5),
                    end_time     DATETIME YEAR TO FRACTION(5),
                    geometry     ST_Geometry)
returns Boolean
ts
The time series value.
begin_time
The start of the time range. Can be NULL to indicate the first element in the time series.
end_time
The end of the time range. Can be NULL to indicate the last element in the time series.
geometry
The region of interest. Can be an ST_Point, ST_MultiPoint, ST_LineString, ST_MultiLineString, ST_Polygon, or ST_MultiPolygon. Must use the SRID 4326.

Usage

Run the STS_TrajectoryCross function to know whether an object crossed the boundary of a specific region during a time range.

The following illustration shows a trajectory that crosses the boundary of the region.

Figure 1: A trajectory that crosses the region boundary twice

The region is crossed in two places by the trajectory.

Returns

t = The object crossed the boundary of the region during the time range.

f = The object did not cross the boundary of the region during the time range.

An exception = An error.

Example

The following query returns whether vehicles crossed the boundary of the specified region between the times of 2015-06-14 12:30:00 and 2015-06-14 13:00:00:

SELECT modid, STS_TrajectoryCross(ts_track, 
         '2015-06-14 12:30:00', '2015-06-14 13:00:00',
         ST_Buffer('4326 point(-78.704122 43.919747)', 10.0, 'meter')) 
         FROM t_vehicle;

modid                                   (expression)

1001                                              f
1002                                              t

2 row(s) retrieved.

Vehicle 1002 crossed the boundary of the region.