Skip to content

ST_Perimeter

Calculates the 2D perimeter of a given geometry.

Usage

double ST_Perimeter(geom: geometry)

Arguments

  • geom (geometry): Input geometry

Description

This function calculates the 2D perimeter of a given geometry. It supports Polygon, MultiPolygon, and GeometryCollection geometries (as long as the GeometryCollection contains polygonal geometries). For other types, it returns 0. To measure lines, use ST_Length.

Examples

SELECT ST_Perimeter(ST_GeomFromWKT('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'));
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_perimeter(st_geomfromwkt(Utf8("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))"))) │
│                                    float64                                   │
╞══════════════════════════════════════════════════════════════════════════════╡
│                                                                         40.0 │
└──────────────────────────────────────────────────────────────────────────────┘