Description
The ST_Area
function calculates and returns the area of given Geometry in
the desired unit. The unit must be specified as a parameter while calling the function. The
area of a polygon is computed as the area of its exterior ring minus the areas of its
interior rings. Points and curves have zero area.
Syntax
ST_Area(WritableGeometry geometry, String areaUnits, [String computationType])
Parameters
Parameter |
Type |
Description |
geometry
|
WritableGeometry |
The input geometry. |
areaUnits
|
String |
The desired return unit type. For valid values, see Area 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.
|
Area Units
Valid values for unit are the following area units:
Value |
Description |
sq mi |
square miles |
sq km |
square kilometers |
sq in |
square inches |
sq ft |
square foot |
sq yd |
square yards |
sq mm |
square millimeters |
sq cm |
square centimeters |
sq m |
square meters |
sq survey ft |
square US Survey feet |
sq nmi |
square nautical miles |
acre |
acres |
ha |
hectares |
Return Values
Return Type |
Description |
Double |
The area of the geometry. |
Examples
SELECT ST_Area(ST_GeomFromWkt(t.geometry,'epsg:4267'), 'sq mi', 'SPHERICAL') FROM table t;
SELECT ST_Area(ST_GeomFromWkt(t.geometry,'epsg:4267'), 'sq mi') FROM table t;