Returns the total length of a trajectory object, in meters.
Syntax
float8 ST_length(trajectory traj, integer srid default 0);Parameters
| Parameter | Description |
|---|---|
traj | The trajectory object. |
srid | The 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)该文章对您有帮助吗?