ST_length

更新时间:
复制 MD 格式

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

Syntax

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

Parameters

ParameterTypeDefaultDescription
trajtrajectoryThe trajectory object.
sridinteger0 (4326)The spatial reference system identifier (SRID) of the trajectory object. When set to 0, the SRID defaults to 4326 (WGS 84).

Description

ST_length computes the spherical length of a trajectory object in meters, based on the object's SRID. Pass the srid parameter to specify a coordinate reference system. If omitted, the SRID defaults to 4326.

Examples

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

Output:

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