ST_Length3D_Spheroid — Calculates the 3D length of a Line represented by its latitude/longitude coordinates.
PostgreSQL
geometry
ST_Length3D_Spheroid(bytea
LineString, varchar
Spheroid);
geometry
ST_Length3D_Spheroid(bytea
LineString, integer
SRID);
geometry
ST_Length3D_Spheroid(bytea
LineString);
H2
geometry
ST_Length3D_Spheroid(bytea
LineString, varchar
Spheroid);
geometry
ST_Length3D_SpheroidEx(bytea
LineString, integer
SRID);
geometry
ST_Length3D_Spheroid(bytea
LineString);
Calculates the 3D length of a Line represented by its latitude/longitude coordinates. Distance is calculated using a particular spheroid. This spheroid can be given by the SRID or by the text, if it's not given this function searches at the geometry SRID.
![]() | |
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 |
|---|---|---|---|
| - | - | - | - |
--PostgreSQL
SELECT ST_Length3D_Spheroid(ga) as length_WGS84,
ST_Length3D_Spheroid( ga,'SPHEROID["GRS_1980",6378137,298.257222101]') as length_GRS80,
ST_Length3D_Spheroid(ga,25830) as length2_GRS80
from (SELECT ST_GeomFromText('LINESTRING(-3.52 41.0 50,2.33 48.86 450)',4326) as ga) as foo;
--H2
SELECT ST_Length3D_Spheroid(ga) as length_WGS84,
ST_Length3D_Spheroid( ga,'SPHEROID["GRS_1980",6378137,298.257222101]') as length_GRS80,
ST_Length3D_SpheroidEx(ga,25830) as length2_GRS80
from (SELECT ST_GeomFromText('LINESTRING(-3.52 41.0 50,2.33 48.86 450)',4326) as ga) as foo;
--Result
length_wgs84 | length_grs80 | length2_grs80
------------------+------------------+------------------
987330.065583086 | 987330.065578359 | 987330.065578359