Skip to content

Returns the Euclidean length of the LineString(s) in a GEOMETRY object.

ST_LENGTH(<geometry>)
Arguments Description
<geometry> The argument must be an expression of type GEOMETRY containing linestrings.

Double.

SELECT
ST_LENGTH(TO_GEOMETRY('POINT(1 1)')) AS length
┌─────────┐
│ length │
├─────────┤
│ 0 │
└─────────┘
SELECT
ST_LENGTH(TO_GEOMETRY('LINESTRING(0 0, 1 1)')) AS length
┌─────────────┐
│ length │
├─────────────┤
│ 1.414213562 │
└─────────────┘
SELECT
ST_LENGTH(
TO_GEOMETRY('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')
) AS length
┌─────────┐
│ length │
├─────────┤
│ 0 │
└─────────┘