Spatiotemporal searches
You run spatiotemporal search functions within SQL statements to find information about moving objects. Trajectories, positions, and regions are represented with spatial data types.
Spatial data types
Most spatiotemporal search functions take a spatial data type as an argument or return a spatial data type.
- ST_Point: A location that is specified by longitude (X) and latitude (Y) coordinate values.
- ST_MultiLineString: A set of one or more linestrings that represent a trajectory. ST_MultiLineStrings are returned by functions that find trajectories.
- ST_Geometry: An abstract noninstantiable superclass. For functions that take an ST_Geometry, supply an ST_Point, ST_MultiPoint, ST_LineString, ST_MultiLineString, ST_Polygon, or ST_MultiPolygon value.
Spatial data types require a spatial reference ID (SRID) that identifies the type of map projection system. For spatiotemporal search data, the SRID must be 4326, which the SRID that is commonly used by global positioning system (GPS) devices.
Spatiotemporal search functions that take a distance parameter to define a region of interest also take an optional unit of measure parameter. By default, the unit of measurement for distance is meters. You can specify a unit of measure that is listed in the unit_name column of the st_units_of_measure table.
Compact and exact trajectories
The trajectories that are stored in the subtrack table are compact versions of the exact trajectories to make queries run faster. Internally, the spatial function SE_Generalize compacts the trajectories. The compact trajectories are indexed and used in most spatiotemporal queries, for example, when you run the STS_TrajectoryCross function. However, you can retrieve the exact trajectory from the time series base table by running the STS_GetTrajectory function. You retrieve the compact trajectory by running the STS_GetCompactTrajectory function. The STS_GetTrajectory function provides more accurate results, but the STS_GetCompactTrajectory function runs faster.
The following illustration shows the difference between the exact trajectory and the compact trajectory.
In this example, the STS_GetTrajectory function returns a trajectory with 16 points. The STS_GetCompactTrajectory function returns a trajectory with 5 points.