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

> Geometry 関数のドキュメント

# Geometry を扱う関数

<div id="geometry">
  ## Geometry
</div>

Geometry 関数では、POLYGON、LINESTRING、MULTIPOLYGON、MULTILINESTRING、RING、POINT などの幾何型の周長と面積を計算できます。ジオメトリは Geometry 型で使用します。入力値が `NULL` の場合、以下のすべての関数は 0 を返します。

<div id="perimetercartesian">
  ## perimeterCartesian
</div>

デカルト座標系 (平面) における、指定されたGeometryオブジェクトの周長を計算します。

**構文**

```sql theme={null}
perimeterCartesian(geom)
```

**引数**

* `geom` — Geometry オブジェクト。[Geometry](/ja/reference/data-types/geo)。

**戻り値**

* 数値 — 座標系の単位で表したオブジェクトの周長。[Float64](/ja/reference/data-types/float)。

**例**

```sql title="Query" theme={null}
CREATE TABLE IF NOT EXISTS geo_dst (geom Geometry) ENGINE = Memory();
INSERT INTO geo_dst SELECT readWKT('POLYGON((0 0,1 0,1 1,0 1,0 0))');
SELECT perimeterCartesian(geom) FROM geo_dst;
```

```response title="Response" theme={null}
┌─perimeterCartesian(geom)─┐
│ 4.0                      │
└──────────────────────────┘
```

<div id="areacartesian">
  ## areaCartesian
</div>

指定されたGeometryオブジェクトの面積をデカルト座標系で計算します。

**構文**

```sql theme={null}
areaCartesian(geom)
```

**引数**

* `geom` — Geometryオブジェクト。[Geometry](/ja/reference/data-types/geo)。

**戻り値**

* 数値 — オブジェクトの面積 (座標系の単位) 。[Float64](/ja/reference/data-types/float)。

**例**

```sql title="Query" theme={null}
CREATE TABLE IF NOT EXISTS geo_dst (geom Geometry) ENGINE = Memory();
INSERT INTO geo_dst SELECT readWKT('POLYGON((0 0,1 0,1 1,0 1,0 0))');
SELECT areaCartesian(geom) FROM geo_dst;
```

```response title="Response" theme={null}
┌─areaCartesian(geom)─┐
│ -1                  │
└─────────────────────┘
```

<div id="perimeterspherical">
  ## perimeterSpherical
</div>

球面上の Geometry オブジェクトの周長を計算します。

**構文**

```sql theme={null}
perimeterSpherical(geom)
```

**引数**

* `geom` — Geometryオブジェクト。[Geometry](/ja/reference/data-types/geo)。

**戻り値**

* 数値 — 周長。[Float64](/ja/reference/data-types/float)。

**例**

```sql title="Query" theme={null}
CREATE TABLE IF NOT EXISTS geo_dst (geom Geometry) ENGINE = Memory();
INSERT INTO geo_dst SELECT readWKT('LINESTRING(0 0,1 0,1 1,0 1,0 0)');
SELECT perimeterSpherical(geom) FROM geo_dst;
```

```response title="Response" theme={null}
┌─perimeterSpherical(geom)─┐
│ 0                        │
└──────────────────────────┘
```

<div id="areaspherical">
  ## areaSpherical
</div>

球面上のGeometryオブジェクトの面積を計算します。

**構文**

```sql theme={null}
areaSpherical(geom)
```

**引数**

* `geom` — Geometry。[Geometry](/ja/reference/data-types/geo)。

**戻り値**

* 数値 — 面積。[Float64](/ja/reference/data-types/float)。

**例**

```sql title="Query" theme={null}
CREATE TABLE IF NOT EXISTS geo_dst (geom Geometry) ENGINE = Memory();
INSERT INTO geo_dst SELECT readWKT('POLYGON((0 0,1 0,1 1,0 1,0 0))');
SELECT areaSpherical(geom) FROM geo_dst;
```

```response title="Response" theme={null}
┌─areaSpherical(geom)────┐
│ -0.0003046096848622019 │
└────────────────────────┘
```
