Name

ST_Length — Returns the 2d length of the geometry if it is a linestring or multilinestring.

Synopsis

float ST_Length(geometry a_2dlinestring);

Description

Returns the 2D length of the geometry if it is a linestring, multilinestring, ST_Curve, ST_MultiCurve. 0 is returned for areal geometries. For areal geometries use ST_Perimeter. Measurements are in the units of the spatial reference system of the geometry.

Currently this is an alias for ST_Length2D, but this may change to support higher dimensions.

This method implements the OpenGIS Simple Features Implementation Specification for SQL. OGC SPEC 2.1.5.1

This method implements the SQL/MM specification: SQL-MM 3: 7.1.2, 9.3.4

Examples

Return length in feet for line string. Note this is in feet because 2249 is Mass State Plane Feet

SELECT SELECT ST_Length(ST_GeomFromText('LINESTRING(743238 2967416,743238 2967450,743265 2967450,
743265.625 2967416,743238 2967416)',2249));
st_length
---------
 122.630744000095
(1 row)
			

See Also

ST_Perimeter