- 카테고리:
ST_MAKEPOLYGON , ST_POLYGON¶
Constructs a GEOGRAPHY or GEOGRAPHY object that represents a polygon without holes. The function uses the specified LineString as the outer loop.
- 참고 항목:
구문¶
ST_MAKEPOLYGON( <geography_or_geometry_expression> )
인자¶
geography_or_geometry_expression
A GEOGRAPHY or GEOMETRY object that represents a LineString in which the last point is the same as the first (i.e. a loop).
반환¶
The function returns a value of type GEOGRAPHY or GEOMETRY.
사용법 노트¶
The lines of the polygon must form a loop. Therefore, the last Point in the sequence of Points defining the LineString must be the same Point as the first Point in the sequence.
ST_POLYGON은 ST_MAKEPOLYGON의 별칭입니다.
For GEOMETRY objects, the returned GEOMETRY object has the same SRID as the input.
예¶
GEOGRAPHY Examples¶
이는 ST_MAKEPOLYGON 함수의 간단한 사용법을 보여줍니다. 아래의 일련의 점은 폭 1도, 높이 2도인 측지 직사각형 영역을 정의하며, 다각형의 왼쪽 하단 모서리는 적도(위도)와 그리니치(경도)에서 시작합니다. 시퀀스의 마지막 점은 루프를 완료하는 첫 번째 점과 동일합니다.
SELECT ST_MAKEPOLYGON( TO_GEOGRAPHY('LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)') ) AS polygon1; +--------------------------------+ | POLYGON1 | |--------------------------------| | POLYGON((0 0,1 0,1 2,0 2,0 0)) | +--------------------------------+
GEOMETRY Examples¶
This shows a simple use of the ST_MAKEPOLYGON function.
SELECT ST_MAKEPOLYGON( TO_GEOMETRY('LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)') ) AS polygon;+--------------------------------+ | POLYGON | |--------------------------------| | POLYGON((0 0,1 0,1 2,0 2,0 0)) | +--------------------------------+