SQL Reference
Geospatial Functions

Spatiotemporal Operators

{{ocientgeo}} spatiotemporal operators perform calculations on geospatial data using an array of timestamp arguments st longestline with the specified two linestring timestamp array pairs, this function returns a two point linestring that represents the maximum distance between points at a concurrent time if the two linestring values do not overlap temporally, this function returns null syntax st longestline(linestring1, ts arr1, linestring2, ts arr2 \[, use spheroid] ) argument data type description linestring1 linestring a geospatial object to be evaluated for its maximum cotemporal distance from linestring2 ts arr1 timestamp array a timestamp array that is paired with linestring1 behavior is undefined if this timestamp array is not monotonically increasing linestring2 linestring a geospatial object to be evaluated for its maximum cotemporal distance from linestring1 ts arr2 timestamp array a timestamp array that is paired with linestring2 behavior is undefined if this timestamp array is not monotonically increasing use spheroid boolean optional if you set this argument to true , this function uses a spheroid model instead of a spherical model defaults to false example select st longestline( st makeline(st point(0, 0), st point(0, 12)), timestamp \[]\( '2020 07 04 07 00 00 000000000', '2020 07 04 11 00 00 000000000'), st makeline(st point(0, 0), st point(8, 0)), timestamp \[]\( '2020 07 04 08 00 00 000000000', '2020 07 04 10 00 00 000000000')); output linestring(0 9, 8 0) to use st longestline as a spatial function to calculate the longest line between two points, see the spatial operators docid\ mn1u46fvbovqpnj63x 6b function st linegetalltimesatpoint returns a timestamp array of all times when the specified linestring value intersects the specified point value if the line never intersects the point, then the function returns an empty timestamp array if the specified inputs are null, the function returns null this function cannot represent intervals of time where the line was stationary at a point, therefore use this function only for mobile paths if the path is stationary, use the spatiotemporal operators docid\ hfujbfjfucmfzncrlejjw function as it can represent intervals of time spent intersecting a stationary linestring syntax st linegetalltimesatpoint(line, timestamp arr, point) argument data type description line linestring a geospatial linestring to be evaluated for all time values in the timestamp arr when it intersects the specified point value if this value is empty, the function returns an empty timestamp array this value must be the same size as the timestamp arr timestamp arr timestamp array a timestamp array that is paired with the line argument timestamp arr must be the same size as the line value behavior is undefined if the timestamp array is not monotonically increasing point point a geospatial point to be evaluated for the time values when the point intersects the line value example select st linegetalltimesatpoint( st makeline(st point(0, 0), st point(4, 0), st point(0, 0)), timestamp \[]\( '2020 07 04 07 00 00 000000000', '2020 07 04 08 00 00 000000000', '2020 07 04 09 00 00 000000000'), st point(0, 0)); output timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 09 00 00 000000000') st linegetpointattime returns a point within the bounds of the specified linestring that corresponds to the interpolated point at the specified timestamp value the specified timestamp value does not need to be an actual value explicitly included in the array the function interpolates the corresponding point, which means that the function approximates the point coordinates from the surrounding values the linestring and timestamp array must be the same size if the timestamp array is not monotonically increasing, the behavior is undefined syntax st linegetpointattime(line, timestamp arr, time for point) argument data type description line linestring a geospatial linestring to be evaluated for an interpolated point, based on the time for point value this value must be the same size as the timestamp arr timestamp arr timestamp array a timestamp array that is paired with the line argument timestamp arr must be the same size as the line value behavior is undefined if the timestamp array is not monotonically increasing time for point timestamp a time value to approximate a point value on the line argument, based on interpolating the values in timestamp arr if this time value precedes the first value in timestamp arr , the function returns the first point on line similarly, if this time value comes after the last value in timestamp arr , the function returns the last point on line example select st linegetpointattime( st makeline(st point(0, 0), st point(4, 0)), timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 08 00 00 000000000'), timestamp('2020 07 04 07 30 00 000000000')); output point(2, 0) st linegettimeatpoint returns the interpolated time of the specified point on the specified linestring that is paired with a timestamp array the linestring and timestamp array must be the same size syntax st linegettimeatpoint(line, timestamp arr, point for time) argument data type description line linestring a geospatial line to be evaluated for an interpolated time value based on the point for time value this value must be the same size as the timestamp arr timestamp arr timestamp array a timestamp array that is paired with the line argument timestamp arr must be the same size as the line value behavior is undefined if the timestamp array is not monotonically increasing point for time point a point value to approximate a timestamp value on the line argument, based on interpolating the values in timestamp arr if line intersects this point value multiple times, then the function returns the earliest time example select st linegettimeatpoint( st makeline(st point(0, 0), st point(4, 0)), timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 08 00 00 000000000'), st point(2, 0)); output timestamp('2020 07 04 07 30 00 000000000') st intersection returns a tuple that represents the intersection of a spatiotemporal linestring with a static geography if t he specified static geography is a point , the returned value is a tuple that contains a paired point array and timestamp array if t he specified static geography is a linestring or polygon , then the returned value is a linestring array paired with a two dimensional timestamp array syntax st intersection(line, timestamp arr, intersection point) argument data type description line linestring a geospatial line to be evaluated for all intersections with the intersection point if this argument is empty, the function returns null timestamp arr timestamp array a timestamp array that is paired with the line argument timestamp arr must be the same size as the line value behavior is undefined if the timestamp array is not monotonically increasing intersection point point, linestring , or polygon a geographic object to evaluate for all intersections with the line argument if this value is empty, the function returns an empty tuple if the value is null, the function returns null example select st intersection( st linestring('linestring(1 1,2 2,3 3)'), timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 11 00 00 000000000', '2020 07 04 12 00 00 000000000'), st polygon('polygon((2 2,3 2,3 3,3 2,2 2))')); output tuple(linestring\[]\(st linestring('linestring(2 2)'), st linestring('linestring(3 3)')), array\[array\[timestamp '2020 07 04 11 00 00 000000000'], array\[timestamp '2020 07 04 12 00 00 000000000']]) st shortestline when you specify two linestring timestamp array pairs, this function returns a linestring with two points that represents the minimum distance between points at a concurrent time if the two linestrings do not overlap temporally, this function returns null syntax st shortestline(linestring1, ts arr1, linestring2, ts arr2 \[, use spheroid ]) argument data type description linestring1 linestring a geospatial object to be evaluated for its minimum cotemporal distance from linestring2 ts arr1 timestamp array a timestamp array that is paired with linestring1 linestring2 linestring a geospatial object to be evaluated for its minimum cotemporal distance from linestring1 ts arr2 timestamp array a timestamp array that is paired with linestring2 use spheroid boolean optional if you set this argument to true , this function uses a spheroid model instead of a spherical model defaults to false example select st shortestline( st makeline(st point(0, 0), st point(4, 0)), timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 08 00 00 000000000'), st makeline(st point(3, 0), st point(4, 8)), timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 07 30 00 000000000')); output linestring(0 09295649430902601 0, 3 0461764508256914 0 37184471667525754) to use st shortestline as a spatial function to calculate the shortest line between two points, see the spatial operators docid\ mn1u46fvbovqpnj63x 6b function related links data types docid\ salunscyvkcxpgzh3m0hd spatiotemporal measurement docid\ absjkm232p3oz0u4ex m1