ST_Length

Determine the length of the linestring or multilinestring geometry.

Syntax

ST_Length(geo[, unit]);
geo
The input geometry.

Type: ST_GEOMETRY(ANY)

unit
The units. Possible values include 'meter', 'kilometer', 'foot', 'mile', and 'nautical mile'.

Type: VARCHAR(ANY)

Default: 'meter'

Returns

A value of type DOUBLE that is the length of the line.

Examples

SELECT inza..ST_Length(inza..ST_WKTToSQL('LINESTRING(0 0, 3 4, -1 1)', 27700), 'meter');

ST_LENGTH
-----------
10
(1 row)
SELECT inza..ST_Length(inza..ST_WKTToSQL('MULTILINESTRING((0 0, 3 4, -1 1), (100 100, 400 500, 800 800))', 27700), 'meter');

ST_LENGTH
-----------
1010
(1 row)