ST_Length3D — Returns the 3-dimensional length of a Geometry.
double ST_Length3D(bytea
Geometry);
Returns the 3d length of a Geometry. Linear geometries return their length. Areal geometries return their perimeter.
![]() | |
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 |
|---|---|---|---|
| - | - | - | - |
SELECT ST_Length3D(ST_GeomFromEWKT('LINESTRING (0 0 8, 10 10 12, 10 5 14, 15 10 16)'));
--Result
27.43057249218311
SELECT ST_Length3D(ST_GeomFromEWKT('POLYGON((0 0 5, 0 10 15, 10 10 15, 10 0 5, 0 0 5))'));
--Result
48.2842712474619
SELECT ST_Length3D(ST_GeomFromEWKT('
GEOMETRYCOLLECTION (POINT (40 30 0), LINESTRING (0 0 8, 10 10 12, 10 5 14, 15 10 16), POLYGON((0 0 5, 0 10 15, 10 10 15, 10 0 5, 0 0 5)))'));
--Result
75.714843739645