ST_length

更新时间:
复制 MD 格式

Returns the total length of a trajectory object, in meters.

Syntax

float8 ST_length(trajectory traj, integer srid default 0);

Parameters

ParameterDescription
trajThe trajectory object.
sridThe spatial reference system identifier (SRID) of the trajectory object. Default value: 0, which is interpreted as SRID 4326.

Description

ST_length computes the spherical length of a trajectory in meters, using the SRID to determine the coordinate reference system. If srid is 0 or not specified, SRID 4326 is used.

Examples

The following example computes the total length of the trajectory with id = 2. Because no srid value is specified, the default SRID 4326 is used.

SELECT st_length(traj) FROM traj WHERE id = 2;

Output:

    st_length
------------------
 13494.6660605311
(1 row)