This topic describes the ST_LengthSpheroid function. This function calculates the 2D or 3D length of a geometry object on an ellipsoid.
Syntax
float ST_LengthSpheroid(geometry aGeometry , spheroid aSpheroid);Parameters
| Parameter | Description |
|---|---|
| aGeometry | The geometry object that you want to specify. |
| aSpheroid | The ellipsoid that you want to define. |
Description
- This function is suitable for geometry objects whose coordinates are represented by longitudes and latitudes and whose lengths are not expected to be reprojected.
- This function supports 3D objects and does not delete z coordinates.
Examples
Calculate the 2D or 3D length of a geometry object by using the default parameter
settings.
SELECT ST_LengthSpheroid('LINESTRING(0 0,1 1)'::geometry,'SPHEROID["WGS 84",6378137,298.257223563]');
st_lengthspheroid
-------------------
156899.56829134
(1 row)