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

# 原生空间函数签名与适用类型

> 列出原生 GEOGRAPHY 和 GEOMETRY 重载、函数 ID、支持的输入以及运行时行为。

类型的坐标语义和使用方式见 [GEOGRAPHY](/documents/cn/4.2/sql-reference/data-types/spatial-types/GEOGRAPHY.md) 和 [GEOMETRY](/documents/cn/4.2/sql-reference/data-types/spatial-types/GEOMETRY.md)。

按参数类型、返回类型和适用的几何形状对照各重载。点击函数名可查看语法和示例。函数 ID 用于 FE 向 BE 分发时识别重载。

## 通用行为

* 原生构造和序列化函数支持全部七种二维 OGC 类型：`POINT`、`LINESTRING`、`POLYGON`、`MULTIPOINT`、`MULTILINESTRING`、`MULTIPOLYGON` 和 `GEOMETRYCOLLECTION`，也支持带类型的 `EMPTY` 和空子对象。
* 参数为 `NULL` 时返回 `NULL`。对于格式错误的 WKT/WKB 或不支持的构造参数，构造函数也返回 `NULL`。
* 原生计算函数要求 XY 值和有效描述符。不支持的类型、维度或描述符会返回受控错误，除非下表明确规定该行的 `EMPTY` 返回 `NULL`。
* `GEOGRAPHY` 与 `GEOMETRY` 是不同的逻辑类型。混合类型调用没有对应重载，因此会被拒绝。
* `GEOGRAPHY` 使用 `OGC:CRS84`、球面边、经度/纬度坐标顺序和 SRID 4326。`GEOMETRY` 使用平面语义和描述符中显式指定的 CRS。使用 [ST\_Transform](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_transform.md) 执行支持的 `GEOMETRY` 坐标重投影。

## 构造函数

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_GeogFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geogfromtext.md) | `VARCHAR wkt` | `GEOGRAPHY` | 全部七种二维类型和 `EMPTY` · 使用原生 `OGC:CRS84` 球面描述符和 SRID 4326。 | 120020 |
| [ST\_GeogFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geogfromtext.md) | `VARCHAR wkt, INT srid` | `GEOGRAPHY` | 全部七种二维类型和 `EMPTY` · `srid` 必须为 4326；结果使用原生 `OGC:CRS84` 球面描述符。 | 120021 |
| [ST\_GeomFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometryfromtext.md) | `VARCHAR wkt, VARCHAR crs` | `GEOMETRY` | 全部七种二维类型和 `EMPTY` · `crs` 必须是非空字符串字面量，并写入平面结果描述符。没有默认 CRS。 | 120022 |
| [ST\_GeogFromWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geogfromwkb.md) | `VARBINARY wkb` | `GEOGRAPHY` | 全部七种二维类型和 `EMPTY`；支持两种 WKB 字节序 · 使用原生 `OGC:CRS84` 球面描述符和 SRID 4326。不支持 EWKB。 | 120030 |
| [ST\_GeogFromWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geogfromwkb.md) | `VARBINARY wkb, INT srid` | `GEOGRAPHY` | 全部七种二维类型和 `EMPTY`；支持两种 WKB 字节序 · `srid` 必须为 4326；结果使用原生 `OGC:CRS84` 球面描述符。不支持 EWKB。 | 120031 |
| [ST\_GeomFromWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geomfromwkb.md) | `VARBINARY wkb, VARCHAR crs` | `GEOMETRY` | 全部七种二维类型和 `EMPTY`；支持两种 WKB 字节序 · `crs` 必须是非空字符串字面量，并写入平面结果描述符。不支持 EWKB 和 Z/M 坐标。 | 120032 |

Geography 坐标必须位于支持的经纬度范围内。Geometry 构造函数不会重新解释坐标，也不会把坐标转换到其他 CRS。参见 [ST\_GeogFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geogfromtext.md)、[ST\_GeogFromWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geogfromwkb.md)、[ST\_GeomFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometryfromtext.md) 和 [ST\_GeomFromWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geomfromwkb.md)。

## 序列化函数

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_AsText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) | `GEOGRAPHY geography` | `VARCHAR` | 输出 WKT，不修改坐标或输入描述符。 | 120040 |
| [ST\_AsText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) | `GEOMETRY geo` | `VARCHAR` | 输出 WKT，不修改坐标或输入描述符。 | 120041 |
| [ST\_AsWKT](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) | `GEOGRAPHY geography` | `VARCHAR` | 原生 `ST_AsText(GEOGRAPHY)` 行为的别名。 | 120050 |
| [ST\_AsWKT](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) | `GEOMETRY geo` | `VARCHAR` | 原生 `ST_AsText(GEOMETRY)` 行为的别名。 | 120051 |
| [ST\_AsBinary](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_asbinary.md) | `GEOGRAPHY geography` | `VARBINARY` | 输出 WKB。逻辑类型、CRS 和边语义仍是类型元数据，不编码为 EWKB。 | 120060 |
| [ST\_AsBinary](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_asbinary.md) | `GEOMETRY geometry` | `VARBINARY` | 输出 WKB。逻辑类型和 CRS 仍是类型元数据，不编码为 EWKB。 | 120061 |
| [ST\_AsWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_asbinary.md) | `GEOGRAPHY geography` | `VARBINARY` | 原生 `ST_AsBinary(GEOGRAPHY)` 行为的别名。 | 120070 |
| [ST\_AsWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_asbinary.md) | `GEOMETRY geometry` | `VARBINARY` | 原生 `ST_AsBinary(GEOMETRY)` 行为的别名。 | 120071 |

参见 [ST\_AsText 和 ST\_AsWKT](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) 以及 [ST\_AsBinary 和 ST\_AsWKB](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_asbinary.md)。

## 初始计算函数

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_X](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_x.md) | `GEOGRAPHY point` | `DOUBLE` | 经度（度） · 非空 XY `POINT` · `NULL` 传递。`EMPTY`、非 `POINT` 或不支持的描述符报错。 | 120080 |
| [ST\_X](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_x.md) | `GEOMETRY point` | `DOUBLE` | 输入 CRS 单位 · 非空 XY `POINT` · `NULL` 传递。`EMPTY`、非 `POINT` 或不支持的描述符报错。 | 120081 |
| [ST\_Y](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_y.md) | `GEOGRAPHY point` | `DOUBLE` | 纬度（度） · 非空 XY `POINT` · `NULL` 传递。`EMPTY`、非 `POINT` 或不支持的描述符报错。 | 120090 |
| [ST\_Y](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_y.md) | `GEOMETRY point` | `DOUBLE` | 输入 CRS 单位 · 非空 XY `POINT` · `NULL` 传递。`EMPTY`、非 `POINT` 或不支持的描述符报错。 | 120091 |
| [ST\_GeometryType](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometrytype.md) | `GEOGRAPHY geography` | `VARCHAR` | 类型名称 · 所有受支持的 XY 类型 · `NULL` 传递。带类型的 `EMPTY` 保留其类型名称。不支持的维度或描述符报错。 | 120170 |
| [ST\_GeometryType](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometrytype.md) | `GEOMETRY geometry` | `VARCHAR` | 类型名称 · 所有受支持的 XY 类型 · `NULL` 传递。带类型的 `EMPTY` 保留其类型名称。不支持的维度或描述符报错。 | 120171 |
| [ST\_Distance](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_distance.md) | `GEOGRAPHY lhs, GEOGRAPHY rhs` | `DOUBLE` | 米 · 球面 CRS84 契约下的 XY `POINT`/`POINT`，或 `POINT` 与 `LINESTRING`/`MULTILINESTRING` · `NULL` 或 `EMPTY` 返回 `NULL`。不支持的类型、维度、描述符或不明确的对跖线段报错。 | 120180 |
| [ST\_Distance](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_distance.md) | `GEOMETRY lhs, GEOMETRY rhs` | `DOUBLE` | 输入 CRS 单位 · 描述符匹配的 XY `POINT`/`POINT`，或 `POINT` 与 `LINESTRING`/`MULTILINESTRING` · `NULL` 或 `EMPTY` 返回 `NULL`。不支持的类型、维度或不兼容描述符报错。 | 120181 |
| [ST\_DWithin](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_dwithin.md) | `GEOGRAPHY point_or_line, GEOGRAPHY line_or_point, DOUBLE distance` | `BOOLEAN` | ；`distance` 单位为米 · XY `POINT` 与 `LINESTRING`/`MULTILINESTRING`，参数顺序不限 · 阈值包含相等边界。`NULL` 传递；`EMPTY` 返回 `false`。阈值必须是有限的非负数。 | 120230 |
| [ST\_DWithin](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_dwithin.md) | `GEOMETRY point_or_line, GEOMETRY line_or_point, DOUBLE distance` | `BOOLEAN` | ；`distance` 使用输入 CRS 单位 · 描述符匹配的 XY `POINT` 与 `LINESTRING`/`MULTILINESTRING`，参数顺序不限 · 阈值包含相等边界。`NULL` 传递；`EMPTY` 返回 `false`。阈值必须是有限的非负数。 | 120231 |

参见 [ST\_X](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_x.md)、[ST\_Y](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_y.md)、[ST\_GeometryType](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometrytype.md)、[ST\_Distance](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_distance.md) 和 [ST\_DWithin](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_dwithin.md)。

## 包含关系谓词

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_Contains](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_contains.md) | `GEOGRAPHY polygon, GEOGRAPHY point` | `BOOLEAN` | 仅当点位于多边形内部时返回 `true`。 | 120190 |
| [ST\_Contains](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_contains.md) | `GEOMETRY polygon, GEOMETRY point` | `BOOLEAN` | 仅当点位于多边形内部时返回 `true`。 | 120191 |
| [ST\_Within](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_within.md) | `GEOGRAPHY point, GEOGRAPHY polygon` | `BOOLEAN` | `ST_Contains` 的反向关系，不包含边界。 | 120200 |
| [ST\_Within](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_within.md) | `GEOMETRY point, GEOMETRY polygon` | `BOOLEAN` | `ST_Contains` 的反向关系，不包含边界。 | 120201 |
| [ST\_Covers](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_covers.md) | `GEOGRAPHY polygon, GEOGRAPHY point` | `BOOLEAN` | 包含外环和内环边界。 | 120210 |
| [ST\_Covers](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_covers.md) | `GEOMETRY polygon, GEOMETRY point` | `BOOLEAN` | 包含外环和内环边界。 | 120211 |
| [ST\_CoveredBy](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_coveredby.md) | `GEOGRAPHY point, GEOGRAPHY polygon` | `BOOLEAN` | `ST_Covers` 的反向关系，包含边界。 | 120220 |
| [ST\_CoveredBy](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_coveredby.md) | `GEOMETRY point, GEOMETRY polygon` | `BOOLEAN` | `ST_Covers` 的反向关系，包含边界。 | 120221 |

这些重载支持 XY `POINT` 与 `POLYGON` 或 `MULTIPOLYGON`。`GEOGRAPHY` 按球面 CRS84 边计算；`GEOMETRY` 按平面边计算并要求描述符匹配。`NULL` 传递，`EMPTY` 输入返回 `false`。不支持的类型、维度、描述符以及混合 `GEOGRAPHY`/`GEOMETRY` 调用会被拒绝。参见 [ST\_Contains](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_contains.md)、[ST\_Within](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_within.md)、[ST\_Covers](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_covers.md) 和 [ST\_CoveredBy](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_coveredby.md)。

## 相交谓词

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_Intersects](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_intersects.md) | `GEOGRAPHY lhs, GEOGRAPHY rhs` | `BOOLEAN` | 球面重叠、包含和边界接触均返回 `true`。 | 120240 |
| [ST\_Intersects](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_intersects.md) | `GEOMETRY lhs, GEOMETRY rhs` | `BOOLEAN` | 平面重叠、包含和边界接触均返回 `true`。 | 120241 |

这些重载支持 XY `POLYGON` 和 `MULTIPOLYGON`。`GEOMETRY` 输入必须具有匹配的描述符。`NULL` 传递，`EMPTY` 输入返回 `false`。不支持的类型、集合以及混合的原生逻辑类型会被拒绝。参见 [ST\_Intersects](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_intersects.md)。

## 度量和属性

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_Area](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_area.md) | `GEOGRAPHY value` | `DOUBLE` | 平方米 · 递归合计面面积，扣除洞，低维分量贡献 0。 | 120250 |
| [ST\_Area](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_area.md) | `GEOMETRY value` | `DOUBLE` | 输入 CRS 单位的平方 · 递归合计面面积，扣除洞，低维分量贡献 0。 | 120251 |
| [ST\_Length](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_length.md) | `GEOGRAPHY value` | `DOUBLE` | 米 · 递归合计线长度，点和面贡献 0。 | 120260 |
| [ST\_Length](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_length.md) | `GEOMETRY value` | `DOUBLE` | 输入 CRS 单位 · 递归合计线长度，点和面贡献 0。 | 120261 |
| [ST\_Perimeter](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_perimeter.md) | `GEOGRAPHY value` | `DOUBLE` | 米 · 递归合计面的外环和内环长度。 | 120270 |
| [ST\_Perimeter](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_perimeter.md) | `GEOMETRY value` | `DOUBLE` | 输入 CRS 单位 · 递归合计面的外环和内环长度。 | 120271 |
| [ST\_Centroid](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_centroid.md) | `GEOGRAPHY value` | `GEOGRAPHY` | 返回带输入描述符的 POINT。 · 使用最高非空维度和球面尺寸权重。 | 120280 |
| [ST\_Centroid](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_centroid.md) | `GEOMETRY value` | `GEOMETRY` | 返回带输入描述符的 POINT。 · 使用最高非空维度和平面尺寸权重。 | 120281 |
| [ST\_IsValid](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_isvalid.md) | `GEOGRAPHY value` | `BOOLEAN` | 使用球面有效性，包括 MultiPolygon 内部重叠检查。 | 120290 |
| [ST\_IsValid](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_isvalid.md) | `GEOMETRY value` | `BOOLEAN` | 使用稳健的平面拓扑有效性。 | 120291 |

这些重载均接受七种二维 OGC 几何形状，并在适用时递归处理 `MULTI*` 和 `GEOMETRYCOLLECTION`。`NULL` 传播；度量对 `EMPTY` 返回 0，`ST_Centroid` 返回 `POINT EMPTY`，`ST_IsValid` 返回 `true`。可读取但拓扑无效的值仅由 `ST_IsValid` 返回 `false`，度量和质心会拒绝该输入。WKB 格式错误、不支持的维度或描述符 会返回错误。

球面面环与方向无关，并归一化为较小区域；单个环不表示超过半球的区域。参见 [ST\_Area](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_area.md)、[ST\_Length](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_length.md)、[ST\_Perimeter](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_perimeter.md)、[ST\_Centroid](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_centroid.md) 和 [ST\_IsValid](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_isvalid.md)。

## CRS 元数据与坐标转换

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_SRID](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_srid.md) | `GEOMETRY value` | `INT` | 没有对应的 EPSG 编号时返回 `NULL`。 · 从描述符读取数字 EPSG 映射，不转换坐标。 | 120300 |
| [ST\_SetSRID](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_setsrid.md) | `GEOMETRY value, INT target_srid` | `GEOMETRY` | 使用目标 EPSG 描述符。 · 只修改元数据；WKB 和坐标保持不变。 | 120305 |
| [ST\_Transform](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_transform.md) | `GEOMETRY value, INT target_srid` | `GEOMETRY` | 使用目标 EPSG 描述符。 · 使用 Web Mercator 公式在 EPSG:4326 和 EPSG:3857 之间重投影 XY 坐标。 | 120310 |

两个函数的目标 SRID 必须是可由 FE 折叠为常量的 4326 或 3857。源 CRS 必须是 EPSG:4326、EPSG:3857 或 OGC:CRS84。`ST_Transform` 处理七种 XY OGC 几何类型及集合；`NULL` 传播，`EMPTY` 保持为空。参见 [ST\_SRID](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_srid.md)、[ST\_SetSRID](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_setsrid.md) 和 [ST\_Transform](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_transform.md)。

## 旧版兼容性

使用旧版 `VARCHAR` 几何编码的完整函数列表见[旧版空间函数](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/legacy-spatial-functions.md)。

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_X](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_x.md#旧版重载) | `VARCHAR point` | `DOUBLE` | — | 120001 |
| [ST\_Y](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_y.md#旧版重载) | `VARCHAR point` | `DOUBLE` | — | 120002 |
| [ST\_AsText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md#旧版重载) | `VARCHAR shape` | `VARCHAR` | — | 120004 |
| [ST\_AsWKT](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md#旧版重载) | `VARCHAR shape` | `VARCHAR` | — | 120005 |
| [ST\_GeometryFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometryfromtext.md#旧版重载) | `VARCHAR wkt` | `VARCHAR` | — | 120006 |
| [ST\_GeomFromText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_geometryfromtext.md#旧版重载) | `VARCHAR wkt` | `VARCHAR` | — | 120007 |
| [ST\_Contains](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_contains.md#旧版重载) | `VARCHAR shape1, VARCHAR shape2` | `BOOLEAN` | — | 120014 |

## 升级与参考测试契约

滚动升级时，应先升级 BE，再升级 FE。原生标量函数使用普通的稳定函数 ID 分发，不引入单独的 GEO 版本门控。覆盖窗口注册表见下文。不支持新 FE 与旧 BE 的升级顺序。

FE 分析器测试验证重载解析、返回类型、旧版兼容性和函数 ID，并由 BE 注册表测试验证每个原生 ID。现有 BE 函数测试覆盖常量、可空值、可变输入、`EMPTY`、格式错误输入、类型、维度、CRS 和描述符行为。

## 多边形叠加运算

支持具有兼容 CRS 的原生 XY 多边形及多多边形；4326 和 3857 均使用笛卡尔语义。NULL 参数返回 NULL。`ST_Union`、`ST_Difference` 和 `ST_SymDifference` 的单个组成部分返回 POLYGON，多个返回 MULTIPOLYGON，空结果返回 POLYGON EMPTY。无效拓扑返回错误。精度与资源限制见链接页面。

`ST_Intersection` 还保留公共边和孤立接触点：无面积时返回线或点类型，混合维度返回 GEOMETRYCOLLECTION。已被较高维结果覆盖的部分不会重复返回；不相交的输入返回 POLYGON EMPTY。

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_Intersection](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_intersection.md) | `GEOMETRY lhs, GEOMETRY rhs` | `GEOMETRY` | — | 120341 |
| [ST\_Union](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_union.md) | `GEOMETRY lhs, GEOMETRY rhs` | `GEOMETRY` | — | 120351 |
| [ST\_Difference](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_difference.md) | `GEOMETRY lhs, GEOMETRY rhs` | `GEOMETRY` | — | 120361 |
| [ST\_SymDifference](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_symdifference.md) | `GEOMETRY lhs, GEOMETRY rhs` | `GEOMETRY` | — | 120371 |

## 笛卡尔缓冲区

支持原生 XY POINT、LINESTRING、POLYGON 及其 MULTI 类型。距离为输入 CRS 单位下的有限有符号值；圆角近似、NULL 传播、空结果为多边形 EMPTY。结果保留 CRS。ST\_Buffer 不支持 GEOGRAPHY、集合、Z/M 或选项。

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_Buffer](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_buffer.md) | `GEOMETRY geometry, DOUBLE distance` | `GEOMETRY` | — | 120401 |

## 保留拓扑的简化

笛卡尔 XY 标量几何，保留类型、环、接触关系、带类型的 EMPTY 子元素和 CRS。容差使用输入坐标单位。不支持 GEOGRAPHY、Z/M 或跨行覆盖简化。

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_SimplifyPreserveTopology](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_simplifypreservetopology.md) | `GEOMETRY geometry, DOUBLE tolerance` | `GEOMETRY` | — | 120411 |

## H3 网格函数

几何参数需要原生 XY CRS84 GEOGRAPHY；网格索引是有符号 BIGINT。有效性、NULL/EMPTY、填充近似和限制见 [H3 函数](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md)。

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [H3\_FromGeo](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `GEOGRAPHY geography, INT resolution` | `BIGINT` | — | 120500 |
| [H3\_GridDisk](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `BIGINT cell, INT k` | `ARRAY<BIGINT>` | — | 120501 |
| [H3\_ToParent](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `BIGINT cell, INT resolution` | `BIGINT` | — | 120502 |
| [H3\_ToChildren](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `BIGINT cell, INT resolution` | `ARRAY<BIGINT>` | — | 120503 |
| [H3\_Resolution](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `BIGINT cell` | `INT` | — | 120504 |
| [H3\_ToBoundary](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `BIGINT cell` | `GEOGRAPHY` | — | 120505 |
| [H3\_PolygonToCells](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/h3-functions.md) | `GEOGRAPHY geography, INT resolution` | `ARRAY<BIGINT>` | — | 120506 |

## 联合覆盖简化（窗口）

两个重载共同处理整个分区，每行返回保留原类型和 CRS 的 XY GEOMETRY。参数必须为可折叠的计划常量，OVER 必需。不支持窗口内 ORDER BY、显式 frame 和普通聚合。拓扑、NULL/EMPTY、容差与资源限制参见 [ST\_CoverageSimplify](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_coveragesimplify.md)。

| 函数 | 参数 | 返回类型 | 使用说明 | 函数 ID |
| - | - | - | - | -: |
| [ST\_CoverageSimplify](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_coveragesimplify.md) | `GEOMETRY geom, DOUBLE tolerance` | `GEOMETRY` | 窗口函数，必须使用 `OVER`。 | — |
| [ST\_CoverageSimplify](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_coveragesimplify.md) | `GEOMETRY geom, DOUBLE tolerance, BOOLEAN simplify_boundary` | `GEOMETRY` | 窗口函数，必须使用 `OVER`。 | — |

未注册 GEOGRAPHY 重载。BE 根据名称及逻辑参数/返回类型在窗口注册表中解析。升级时先升级 BE，再升级 FE。


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