SQL Reference
Geospatial Functions
Spatiotemporal Measurement
{{ocientgeo}} s patiotemporal measurement functions can perform basic calculations on geospatial data that is paired with timestamp data st distance returns the two dimensional interpolated minimum simultaneous distance between two linestring timestamp array pairs in the specified unit of measurement if any argument is null or empty, the function returns null if either linestring timestamp array pair has a mismatched number of points and timestamps, the function returns an error behavior is undefined if either timestamp array is not monotonically increasing st distance(geo1, ts arr1, geo2, ts arr2, units \[, use spheroid] ) argument data type description geo1 linestring a geospatial object to be evaluated for its minimum cotemporal distance from geo2 ts arr1 timestamp array a timestamp array that is paired with geo1 geo2 linestring a geospatial object to be evaluated for its minimum cotemporal distance from geo1 ts arr2 timestamp array a timestamp array that is paired with geo2 units string the unit of measurement used for the minimum cotemporal distance accepted options include "feet", "kilometers", "miles", or "meters" defaults to "meters" 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 distance( st linestring('linestring(0 0,0 12)'), timestamp \[]\( '2020 07 04 07 00 00 000000000', '2020 07 04 11 00 00 000000000'), st linestring('linestring(0 0,6 0)'), timestamp \[]\( '2020 07 04 08 00 00 000000000', '2020 07 04 10 00 00 00000000'), 'miles', true); output 206 124 to use st distance as a spatial function to calculate the minimum distance between two points, see the spatial measurement docid\ wl 1wpoiuauejgdvofohc function in the spatial measurement section st maxdistance returns the two dimensional interpolated maximum cotemporal distance between two linestring timestamp array pairs in the specified unit of measurement if any argument is null or empty, the function returns null if either linestring timestamp array pair has a mismatched number of points and timestamps, the function returns an error behavior is undefined if either timestamp array is not monotonically increasing st maxdistance(geo1, ts arr1, geo2, ts arr2, units \[, use spheroid] ) argument data type description geo1 linestring a geospatial object to be evaluated for its maximum cotemporal distance from geo2 ts arr1 timestamp array a timestamp array that is paired with geo1 geo2 linestring a geospatial object to be evaluated for its maximum cotemporal distance from geo1 ts arr2 timestamp array a timestamp array that is paired with geo2 units string the unit of measurement used for the maximum cotemporal distance accepted options include "feet", "kilometers", "miles", or "meters" defaults to "meters" 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 maxdistance( st linestring('linestring(0 0,0 12)'), timestamp\[]\('2020 07 04 07 00 00 000000000', '2020 07 04 11 00 00 000000000'), st linestring('linestring(0 0,6 0)'), timestamp\[]\('2020 07 04 08 00 00 000000000', '2020 07 04 10 00 00 00000000'), 'miles', true); output 743 83 to use st maxdistance as a spatial function to calculate the maximum distance between two points, see the spatial measurement docid\ wl 1wpoiuauejgdvofohc function in the spatial measurement section st totalsecondsinintersection returns the total number of seconds spent in the intersection result calculated by the spatiotemporal version of spatiotemporal operators docid\ ujzu ikrvmucbv0el6kkn execute this function only with the result from st intersection if the input is an empty, correctly typed tuple, this function returns 0 seconds if the input is null, this function returns null st totalsecondsinintersection(tpl) argument data type description tpl tuple of linestring timestamp pairs a tuple of linestring timestamp pairs used to evaluate how long an intersection existed example select st totalsecondsinintersection( st intersection( st linestring('linestring(1 1,2 2,1 1)'), timestamp\[]\( '2020 07 04 07 00 00 000000000', '2020 07 04 11 00 00 000000000', '2020 07 04 12 00 00 000000000'), st linestring('linestring(2 2,1 1)'))); output 18000 0 related links data types docid\ g9 6amoszrxd9exdwggcz spatiotemporal operators docid\ ujzu ikrvmucbv0el6kkn