> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# GEOMETRY

> 用于带显式坐标参考系的平面坐标的原生空间类型。

`GEOMETRY` 是表示平面空间数据的原生 SQL 类型。坐标参考系（CRS）保存在类型描述符中。空间运算使用所属 CRS 的坐标单位。例如，`EPSG:3857` 的平面距离使用投影米。涉及两个平面值的运算可能要求 CRS 描述符一致。

## 距离与面积

距离与面积请分别参阅 [ST\_Distance](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_distance.md) 和 [ST\_Area](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_area.md)。距离使用输入 CRS 的坐标单位，面积使用该单位的平方。例如，EPSG:3857 的距离和面积分别使用投影米和投影平方米。

## 构造值

使用 [ST\_GeomFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometryfromtext.md) 读取 WKT，或使用 [ST\_GeomFromWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geomfromwkb.md) 读取 WKB。这两个原生构造函数都要求显式传入 CRS 字符串字面量，支持七种二维 OGC 几何形状，包括带形状类别的 `EMPTY` 值。单参数形式 `ST_GeomFromText(wkt)` 返回旧版 `VARCHAR` 编码。

## 查询与序列化

```sql theme={null}
SELECT ST_AsText(ST_GeomFromText('POINT (1000 2000)', 'EPSG:3857')) AS point_wkt;
-- POINT (1000 2000)
```

向客户端返回 `GEOMETRY` 时，使用 [ST\_AsText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) 转为 WKT，或使用 [ST\_AsBinary](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_asbinary.md) 转为 WKB。使用 [ST\_Transform](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_transform.md) 在受支持的坐标系之间重投影。Iceberg 字段的读取条件见 [Iceberg 类型映射](/documents/cn/4.2/data_source/catalog/iceberg/iceberg.md)。球面经纬度见 [GEOGRAPHY](/documents/cn/4.2/sql-reference/data-types/spatial-types/GEOGRAPHY.md)。可按用途查看[空间函数](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/native-spatial-functions.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.