- Categories:
ST_ PERIMETER¶
Returns the length of the perimeter of the polygon(s) in a GEOGRAPHY or GEOMETRY object.
Syntax¶
Arguments¶
geography_or_geometry_expressionThe argument must be of type GEOGRAPHY or GEOMETRY.
Returns¶
Returns a REAL value, which represents the length:
- For GEOGRAPHY objects, the length is in meters.
- For GEOMETRY objects, the length is computed with the same unit used to define the coordinates.
Usage notes¶
- If
geography_or_geometry_expressionis not a Polygon, MultiPolygon, or GeometryCollection containing Polygons, ST_PERIMETER returns 0. - If
geography_or_geometry_expressionis 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¶
GEOGRAPHY 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:
GEOMETRY examples¶
The following example demonstrates how to use the ST_PERIMETER function.