카테고리:

지리 공간 함수

# ST_AREA¶

Returns the area of the Polygon(s) in a GEOGRAPHY or GEOMETRY object.

## 구문¶

ST_AREA( <geography_or_geometry_expression> )


## 인자¶

geography_expression

The argument must be of type GEOGRAPHY or GEOMETRY.

## 반환¶

Returns a REAL value, which represents the area:

• For GEOGRAPHY input values, the area is in square meters.

• For GEOMETRY input values, the area is computed with the same units used to define the input coordinates.

## 사용법 노트¶

• geography_expression 이 Polygon, MultiPolygon, 또는 다각형을 포함하는 GeometryCollection이 아닌 경우, ST_AREA는 0을 반환합니다.

• geography_expression 이 GeometryCollection인 경우, ST_AREA는 컬렉션에 있는 다각형 영역의 합계를 반환합니다.

## 예¶

### GEOGRAPHY Examples¶

This uses the ST_AREA function with GEOGRAPHY objects to calculate the area of Earth’s surface 1 degree on each side with the bottom of the area on the equator:

SELECT ST_AREA(TO_GEOGRAPHY('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')) AS area;
+------------------+
|             AREA |
|------------------|
| 12364036567.0764 |
+------------------+


### GEOMETRY Examples¶

The following example calls the ST_AREA function with GEOMETRY objects that represent a Point, LineString, and Polygon.

SELECT ST_AREA(g), ST_ASWKT(g)
FROM (SELECT TO_GEOMETRY(column1) as g
from values ('POINT(1 1)'),
('LINESTRING(0 0, 1 1)'),
('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'));

+------------+--------------------------------+
| ST_AREA(G) | ST_ASWKT(G)                    |
|------------+--------------------------------|
|          0 | POINT(1 1)                     |
|          0 | LINESTRING(0 0,1 1)            |
|          1 | POLYGON((0 0,0 1,1 1,1 0,0 0)) |
+------------+--------------------------------+

맨 위로 이동