> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_Length

> Returns the length of the one-dimensional components of a native GEO value.

Returns the total length of the one-dimensional components of a native GEO value. `GEOGRAPHY` results are meters along great-circle edges. `GEOMETRY` results use the coordinate units of the input CRS.

## Syntax

```sql theme={null}
DOUBLE ST_Length(GEOGRAPHY value)
DOUBLE ST_Length(GEOMETRY value)
```

`LINESTRING` and `MULTILINESTRING` contribute their segment lengths. Line components inside a `GEOMETRYCOLLECTION` are summed recursively. Points and polygon boundaries contribute zero; use `ST_Perimeter` for polygon boundaries.

`NULL` produces `NULL`; an `EMPTY` value produces `0`. Malformed WKB, unsupported dimensions or descriptors, ambiguous antipodal spherical segments, and topologically invalid inputs produce a controlled error.

## Examples

```SQL theme={null}
SELECT ST_Length(ST_GeomFromText('LINESTRING (0 0, 3 4)', 'EPSG:3857'));
-- 5

SELECT ST_Length(ST_GeogFromText('LINESTRING (0 0, 1 0)'));
-- approximately 111195.101177484 meters
```

## Keywords

ST\_LENGTH,ST,LENGTH,GEOGRAPHY,GEOMETRY

## Related data types

[GEOGRAPHY](/documents/4.2/sql-reference/data-types/spatial-types/GEOGRAPHY.md), [GEOMETRY](/documents/4.2/sql-reference/data-types/spatial-types/GEOMETRY.md), [DOUBLE](/documents/4.2/sql-reference/data-types/numeric/DOUBLE.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.