This topic describes the ST_Length2D function. This function calculates the length of a LineString object or MultiLineString object within the 2D space of the object. This function is equivalent to the ST_Length function.

Syntax

float  ST_Length2D(geometry  a2dlinestring);

Parameters

Parameter Description
a2dlinestring The 2D linear geometry object that you want to specify.

Examples

Calculate the length of a geometry object within the 2D space of the object by using the default parameter settings.
SELECT ST_Length('LINESTRING(0 0,1 1)'::geometry);
    st_length
-----------------
 1.4142135623731
(1 row)