Appearance
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>
: TheGEOGRAPHY
object to compute the perimeter of<use_spheroid>
: OptionalBOOLEAN
. IfFALSE
, calculations use spherical approximation instead of spheroid. Defaults toTRUE
.
Returns
Returns a FLOAT8
value representing the perimeter in meters:
- For surfaces (
POLYGON
,MULTIPOLYGON
): returns the perimeter - For non-surface types (
POINT
,LINESTRING
): returns0
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