Categories:

Geospatial Functions

ST_PERIMETER

Returns the geodesic length in meters of the perimeter of the polygon(s) in a GEOGRAPHY object.

Syntax

ST_PERIMETER( <geography_expression> )

Arguments

geography_expression

The argument must be of type GEOGRAPHY.

Returns

Returns a REAL value, which represents the length in meters.

Usage Notes

  • If geography_expression is not a Polygon, MultiPolygon, or GeometryCollection containing polygons, ST_PERIMETER returns 0.

  • If geography_expression is a GeometryCollection, ST_PERIMETER returns the sum of the perimeters of the polygons in the collection.

  • Use this function (rather than ST_LENGTH) to get the perimeter of a polygon.

Examples

This calculates the length of the perimeter of a polygon that is one degree of arc on each edge and has one edge on the equator:

SELECT ST_PERIMETER(TO_GEOGRAPHY('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'));
+------------------------------------------------------------------+
| ST_PERIMETER(TO_GEOGRAPHY('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')) |
|------------------------------------------------------------------|
|                                                 444763.468727621 |
+------------------------------------------------------------------+