ST_AREA (Azure Cosmos DB)

APPLIES TO: NoSQL

Returns the total area of a GeoJSON Polygon or MultiPolygon expression. To learn more, see the Geospatial and GeoJSON location data article.

Syntax

ST_AREA (<spatial_expr>)

Arguments

spatial_expr
Is any valid GeoJSON Polygon or MultiPolygon object expression.

Return types

Returns the total area of a set of points. This is expressed in square meters for the default reference system.

Examples

The following example shows how to return the area of a polygon using the ST_AREA built-in function.

SELECT ST_AREA({
    "type":"Polygon",
    "coordinates":[ [
        [ 31.8, -5 ],
        [ 32, -5 ],
        [ 32, -4.7 ],
        [ 31.8, -4.7 ],
        [ 31.8, -5 ]
    ] ]
}) as Area

Here is the result set.

[
    {
        "Area": 735970283.0522614
    }
]

Remarks

Using the ST_AREA function to calculate the area of zero or one-dimensional figures like GeoJSON Points and LineStrings will result in an area of 0.

Note

The GeoJSON specification requires that points within a Polygon be specified in counter-clockwise order. A Polygon specified in clockwise order represents the inverse of the region within it.

Next steps