Description
The ST_Perimeter
function calculates and returns the total perimeter of a
given geometry in the desired unit type. The Perimeter of a polygon is the sum of the
lengths of its rings (both exterior and holes). The curves are considered as thin
polygons.
Syntax
ST_Perimeter(WritableGeometry geometry, String linearUnits, [String computationType])
Parameters
Parameter |
Type |
Description |
geometry
|
WritableGeometry |
The input geometry. |
linearUnits
|
String |
The desired return unit type. For valid values, see Linear Units. |
computationType
|
String |
Optional. Indicates the logic to be used to interpret geometry coordinates. The
computation type is based on the coordinate system of the geometry being operated
on:
- For geographic (long/lat) coordinate systems: Valid type =
SPHERICAL (default)
- For projected coordinate systems: Valid types =
CARTESIAN ,
SPHERICAL (default)
- For engineering coordinate systems: Valid type =
CARTESIAN
(default)
- CARTESIAN
- The geometry coordinates are interpreted using cartesian logic.
- SPHERICAL
- The geometry coordinates are interpreted using spherical logic.
|
Linear Units
Valid values for unit type:
Value |
Description |
mi |
miles |
km |
kilometers |
in |
inches |
ft |
feet |
yd |
yards |
mm |
millimeters |
cm |
centimeters |
m |
meters |
survey ft |
US Survey feet |
nmi |
nautical miles |
Return Values
Return Type |
Description |
Double |
The perimeter of the geometry. |
Examples
SELECT ST_Perimeter(ST_GeomFromWkt(t.geometry,'epsg:4267'), 'm', 'SPHERICAL') FROM table t;
SELECT ST_Perimeter(ST_GeomFromWkt(t.geometry,'epsg:4267'), 'm') FROM table t;