Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Returns the area of the input GEOGRAPHY
or GEOMETRY
value.
Syntax
st_area ( geoExpr )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value.
Returns
A value of type DOUBLE
, representing the area of the input GEOGRAPHY
or GEOMETRY
value.
If the input is a GEOGRAPHY
value, the function returns the 2D geodesic area of the of the GEOGRAPHY
value.
Specifically, the function returns the geodesic area for polygons, and the sum of the areas of the polygons in a multipolygons.
For non-areal geographies (points, linestrings, multipoints, and multilinestrings) 0 is returned, whereas for geometry collections the function returns the sum of the areas of the elements in the collection.
The result is computed by performing the inverse geodesic calculation assuming the WGS84 ellipsoid.
The units of the result is square meters.
If the input is a GEOMETRY
value, the function returns the 2D Cartesian area of the GEOMETRY
value.
Specifically, the function returns the 2D Cartesian area for polygons, and the sum of the areas of the polygons in a
multipolygon.
For non-areal geometries (points, linestrings, multipoints, and multilinestrings) 0 is returned, whereas for geometry collections it returns the sum of the areas of the elements in the collection.
The units of the result are those of the spatial reference system of the input GEOMETRY
value, squared.
The function returns NULL
if any of the inputs is NULL
.
Examples
-- Returns the area of a 2D Cartesian polygon with a hole.
> SELECT st_area(st_geomfromtext('POLYGON((0 0,50 0,50 50,0 50,0 0),(20 20,25 30,30 20,20 20))'))
2450.0