Name

ST_Length3D — Returns the 3-dimensional length of a Geometry.

Synopsis

double ST_Length3D(bytea Geometry);

Alias

Length3D

Description

Returns the 3d length of a Geometry. Linear geometries return their length. Areal geometries return their perimeter.

[Note]

This function supports GeometryCollections.

Coordinate Dimensions
2D3DM
Spatial Standards Support
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
----

Examples

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

Related functions

ST_Length