ST_LENGTH
functionsupportedCore SQL functionsReturns the great circle length of the LineString(s) in a GEOGRAPHY object or the Euclidean length of the LineString(s) in a GEOMETRY object.
Syntax
ST_LENGTH( <geography_or_geometry_expression> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_or_geometry_expression | required | The argument must be of type GEOGRAPHY or GEOMETRY. |
Returns
Returns a REAL value, which represents the length: - For GEOGRAPHY input values, the length is in meters. - For GEOMETRY input values, the length is computed with the same units used to define the input coordinates.
Usage notes
- If geography_or_geometry_expression is not a LineString, MultiLineString, or GeometryCollection containing linestrings, ST_LENGTH returns 0.
- If geography_or_geometry_expression is a GeometryCollection, ST_LENGTH returns the sum of the lengths of the linestrings in the collection.
- If you want the perimeter length of a polygon, use the ST_PERIMETER function instead.