ST_Length — Returns the 2-dimensional length of a Geometry.
double ST_Length(
bytea
Geometry)
;
Returns the 2d length of a Geometry. Linear geometries return their length. Areal geometries return their perimeter.
Spatial Standards OGC defines the function for LineStrings and MultiLineStrings. Jaspa adds support to areal Geometries.
This function supports GeometryCollections. |
2D | 3D | M |
---|---|---|
- | - |
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
2.1.5.1 , 2.1.7.1 | 7.2.12.1 , 7.2.17.1 | 7.2.10.2 , 7.2.17.2 | 7.1.2 , 9.3.4 Linear 8.1.3 , 9.5.4 Areal |
SELECT ST_Length(ST_GeomFromText('LINESTRING (0 0, 10 10, 10 5, 15 10)')); --Result 26.213203435596427 SELECT ST_Length2D(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')); --Result 40.0 SELECT ST_Length(ST_GeomFromText('GEOMETRYCOLLECTION (POINT (40 30),LINESTRING (0 0, 10 10, 10 5, 15 10),POLYGON((0 0, 0 10, 10 10, 10 0, 0 0)))')); --Result 66.21320343559643