ST_AREA (NoSQL query)

APPLIES TO: NoSQL

Returns the total area of a GeoJSON Polygon or MultiPolygon expression.

Note

For more information, see Geospatial and GeoJSON location data.

Syntax

ST_AREA(<spatial_expr>)

Arguments

Description
spatial_expr Any valid GeoJSON Polygon or MultiPolygon expression.

Return types

Returns a numeric expression that enumerates the total area of a set of points.

Examples

The following example shows how to return the area of a polygon.

SELECT VALUE {
    areaPolygon: ST_AREA({
        "type": "Polygon",
        "coordinates": [ [
            [ 31.8, -5 ],
            [ 32, -5 ],
            [ 32, -4.7 ],
            [ 31.8, -4.7 ],
            [ 31.8, -5 ]
        ] ]
    })
}
[
  {
    "areaPolygon": 735970283.0522614
  }
]

Remarks

  • The result is expressed in square meters for the default reference system.
  • Using this function to calculate the area of zero or one-dimensional figures like GeoJSON Points and LineStrings results in an area of 0.
  • 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.