SQL Reference
Geospatial Functions

Spatiotemporal Measurement

 spatiotemporal 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.

SQL


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

SQL


Output: 206.124

To use ST_DISTANCE as a spatial function to calculate the minimum distance between two points, see the ST_DISTANCE 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.

SQL


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

SQL


Output: 743.83

To use ST_MAXDISTANCE as a spatial function to calculate the maximum distance between two points, see the ST_MAXDISTANCE 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 ST_INTERSECTION.

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.

SQL


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

SQL


Output: 18000.0

Related Links