public class ST_Length
extends GenericUDF
Returns the length of a line or polygon geometry.
Format:
ST_Length(geometry ST_Geometry, tolerance NUMBER) - returns the length of a line or polygon geometry
The tolerance is optional.
By default the tolerance is 0.05 for geodetic geometries and 0 for non geodetic.
For projected data, the length is in the same unit as the unit of projection. For Geodetic, the length is in meters.
Return -1 in case of error.
Example:
select ST_Length((
ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 6], [1, 6], [1, 2]]]}', 0)
) from hivetable LIMIT 1; -- return 16