STS_GetLocWithin function
The STS_GetLocWithin function returns the set of objects whose trajectory is within the specified region during the specified time range.
Syntax
STS_GetLocWithin(
subtrack_name VARCHAR(128),
begin_time DATETIME YEAR TO FRACTION(5),
end_time DATETIME YEAR TO FRACTION(5),
geometry ST_Geometry)
returns ROW
- subtrack_name
- The name of the subtrack table.
- 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_GetLocWithin function to find which objects were moving in a region at a specific time. The trajectory of an object must intersect the region and the object must have a recorded position within the region to be returned by the STS_GetLocWithin function.
Returns
A set of primary key values = The objects that were moving in the region.
NULL = Nothing found.
Example
The following statement returns which vehicles moved within the specified region between the times of 2014-06-10 16:30:00 and 2014-06-10 17:00:00:
SELECT * from TABLE(STS_GetLocWithin('t_vehicle_subtrack',
'2014-06-10 16:30:00', '2014-06-10 17:00:00',
ST_Buffer('4326 POINT(-78.752717 43.922478)'::ST_Point,
640, 'meter'))::row(modid varchar(60)))
AS t(mid);
mid ROW('1001')
1 row(s) retrieved.
Vehicle 1001 was in the region.