> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> flipCoordinates 참고 문서

# 좌표 반전

<div id="flipcoordinates">
  ## flipCoordinates
</div>

`flipCoordinates` 함수는 Point, Ring, 다각형 또는 Multipolygon의 좌표 순서를 서로 바꿉니다. 예를 들어 위도와 경도의 순서가 서로 다른 좌표계 간에 변환할 때 유용합니다.

```sql theme={null}
flipCoordinates(coordinates)
```

<div id="input-parameters">
  ### 입력 매개변수
</div>

* `coordinates` — Point `(x, y)`를 나타내는 튜플 또는 Ring, Polygon, Multipolygon을 나타내는 이러한 튜플의 배열입니다. 지원되는 입력 타입은 다음과 같습니다.
  * [**Point**](/ko/reference/data-types/geo#point): `x`와 `y`가 [Float64](/ko/reference/data-types/float) 값인 튜플 `(x, y)`입니다.
  * [**Ring**](/ko/reference/data-types/geo#ring): Point들의 배열 `[(x1, y1), (x2, y2), ...]`입니다.
  * [**Polygon**](/ko/reference/data-types/geo#polygon): Ring들의 배열 `[ring1, ring2, ...]`이며, 각 Ring은 Point들의 배열입니다.
  * [**Multipolygon**](/ko/reference/data-types/geo#multipolygon): Polygon들의 배열 `[polygon1, polygon2, ...]`입니다.

<div id="returned-value">
  ### 반환 값
</div>

이 함수는 좌표가 뒤바뀐 입력값을 반환합니다. 예시는 다음과 같습니다.

* Point `(x, y)`는 `(y, x)`가 됩니다.
* Ring `[(x1, y1), (x2, y2)]`은 `[(y1, x1), (y2, x2)]`가 됩니다.
* Polygon 및 Multipolygon과 같은 중첩 구조는 재귀적으로 처리됩니다.

<div id="examples">
  ### 예시
</div>

<div id="example-1">
  #### 예시 1: 한 Point 뒤집기
</div>

```sql theme={null}
SELECT flipCoordinates((10, 20)) AS flipped_point
```

```text theme={null}
┌─flipped_point─┐
│ (20,10)       │
└───────────────┘
```

<div id="example-2">
  #### 예시 2: 점 배열(Ring) 뒤집기
</div>

```sql theme={null}
SELECT flipCoordinates([(10, 20), (30, 40)]) AS flipped_ring
```

```text theme={null}
┌─flipped_ring──────────────┐
│ [(20,10),(40,30)]         │
└───────────────────────────┘
```

<div id="example-3">
  #### 예시 3: Polygon 뒤집기
</div>

```sql theme={null}
SELECT flipCoordinates([[(10, 20), (30, 40)], [(50, 60), (70, 80)]]) AS flipped_polygon
```

```text theme={null}
┌─flipped_polygon──────────────────────────────┐
│ [[(20,10),(40,30)],[(60,50),(80,70)]]        │
└──────────────────────────────────────────────┘
```

<div id="example-4">
  #### 예시 4: Multipolygon의 좌표 뒤집기
</div>

```sql theme={null}
SELECT flipCoordinates([[[10, 20], [30, 40]], [[50, 60], [70, 80]]]) AS flipped_multipolygon
```

```text theme={null}
┌─flipped_multipolygon──────────────────────────────┐
│ [[[20,10],[40,30]],[[60,50],[80,70]]]             │
└───────────────────────────────────────────────────┘
```
