ST_Length function
The ST_Length function takes a curve or multicurve and, optionally, a unit as input parameters and returns the length of the given curve or multicurve in the default or given unit of measure.
If the given curve or multicurve is null or is empty, null is returned.
This function can also be called as a method.
Syntax
Parameter
- curve
- A value of type ST_Curve or ST_MultiCurve that represents the curves for which the length is returned.
- unit
- A VARCHAR(128) value that identifies the units in which the length of the curve is measured. The supported units of measure are listed in the DB2GSE.ST_UNITS_OF_MEASURE catalog view.
If the unit parameter is omitted, the following
rules are used to determine the unit in which the length is measured:
- If curve is in a projected or geocentric coordinate system, the linear unit associated with this coordinate system is the default.
- If curve is in a geographic coordinate system, the angular unit associated with this coordinate system is the default.
Restrictions on unit conversions: An error (SQLSTATE
38SU4) is returned if any of the following conditions occur:
- The curve is in an unspecified coordinate system and the unit parameter is specified.
- The curve is in a projected coordinate system and an angular unit is specified.
- The curve is in a geographic coordinate system, and a linear unit is specified.
Return type
DOUBLE