ST_PERIMETER()

All functions > GEOSPATIAL > ST_PERIMETER()

Returns the perimeter of an areal geometry or geography.

Signatures

Perimeter

Returns: Perimeter of the input

ST_PERIMETER(geo: T) → DOUBLE
sql
ParameterTypeRequiredDescription
geoTYesGeometry or geography value

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY

Signature notes:

  • On GEOMETRY: returns planar perimeter in SRID coordinate units
  • On GEOGRAPHY: returns the perimeter in meters on a sphere of radius 6 371 008.8 m (the mean Earth radius), with great-circle edges; this differs from the WGS84 ellipsoid by up to about 0.5 %
  • Returns 0.0 for non areal sub kinds (Point, LineString)
  • Not supported on Trino
  • Returns NULL if the input is NULL

Availability

StatusBackends
Not availableclickhouse, trino, mysql

Examples

FeatureQL
RETURN
    -- Perimeter of a 10x10 square
    f1 := ST_PERIMETER(
        ST_GEOMFROMTEXT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))')
    )
;
Result
f1 DECIMAL
40.0