Skip to content

ST_PERIMETER

Returns the perimeter of a GEOGRAPHY surface in meters. Returns 0 for non-surface types (points, lines). For linear geographies, use ST_LENGTH instead.

See also:

Syntax

sql
ST_PERIMETER(<input>[, <use_spheroid>])

Arguments

  • <input>: The GEOGRAPHY object to compute the perimeter of
  • <use_spheroid>: Optional BOOLEAN. If FALSE, calculations use spherical approximation instead of spheroid. Defaults to TRUE.

Returns

Returns a FLOAT8 value representing the perimeter in meters:

  • For surfaces (POLYGON, MULTIPOLYGON): returns the perimeter
  • For non-surface types (POINT, LINESTRING): returns 0

Example

sql
SELECT ST_Perimeter('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::GEOGRAPHY);
-- 443770.917248302

SELECT ST_Perimeter('POINT(0 0)'::GEOGRAPHY);
-- 0