public class ST_Area
extends GenericUDF
Returns the area of a polygon or multipolygon geometry.
Format:
ST_Area(geometry ST_Geometry, tolerance NUMBER) - returns the area of a polygon or multi 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 area is in the same unit as the unit of projection. For Geodetic, the area is in square meters.
Return -1 in case of error.
Example:
select ST_Area(
ST_Polygon('{"type": "Polygon","coordinates": [[[1, 2], [5, 2], [5, 7], [1, 7], [1, 2]]]}', 0)
) from hivetable LIMIT 1; -- return 20