ST_Length(ls [, unit])

Returns a double-precision number indicating the length of the
LineString or MultiLineString value ls in its associated spatial
reference system. The length of a MultiLineString value is equal to the
sum of the lengths of its elements.

ST_Length() computes a result as follows:

o If the geometry is a valid LineString in a Cartesian SRS, the return
  value is the Cartesian length of the geometry.

o If the geometry is a valid MultiLineString in a Cartesian SRS, the
  return value is the sum of the Cartesian lengths of its elements.

o If the geometry is a valid LineString in a geographic SRS, the return
  value is the geodetic length of the geometry in that SRS, in meters.

o If the geometry is a valid MultiLineString in a geographic SRS, the
  return value is the sum of the geodetic lengths of its elements in
  that SRS, in meters.

ST_Length() handles its arguments as described in the introduction to
this section, with these exceptions:

o If the geometry is not a LineString or MultiLineString, the return
  value is NULL.

o If the geometry is geometrically invalid, either the result is an
  undefined length (that is, it can be any number), or an error occurs.

o If the length computation result is +inf, an ER_DATA_OUT_OF_RANGE
  error occurs.

o If the geometry has a geographic SRS with a longitude or latitude
  that is out of range, an error occurs:

  o If any longitude argument is not in the range (−180, 180], an
    ER_LONGITUDE_OUT_OF_RANGE error occurs.

  o If any latitude argument is not in the range [−90, 90], an
    ER_LATITUDE_OUT_OF_RANGE error occurs.

  Ranges shown are in degrees. The exact range limits deviate slightly
  due to floating-point arithmetic.

As of MySQL 8.0.16, ST_Length() permits an optional unit argument that
specifies the linear unit for the returned length value. These rules
apply:

o If a unit is specified but not supported by MySQL, an
  ER_UNIT_NOT_FOUND error occurs.

o If a supported linear unit is specified and the SRID is 0, an
  ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT error occurs.

o If a supported linear unit is specified and the SRID is not 0, the
  result is in that unit.

o If a unit is not specified, the result is in the unit of the SRS of
  the geometries, whether Cartesian or geographic. Currently, all MySQL
  SRSs are expressed in meters.

A unit is supported if it is found in the INFORMATION_SCHEMA
ST_UNITS_OF_MEASURE table. See
https://dev.mysql.com/doc/refman/8.0/en/st-units-of-measure-table.html.

URL: https://dev.mysql.com/doc/refman/8.0/en/gis-linestring-property-functions.html

