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

# ST_GeomFromWKB

> 使用显式 CRS 从 WKB 构造原生 GEOMETRY 值。

从二维 OGC Well-Known Binary（WKB）构造原生平面 `GEOMETRY` 值。

## 语法

```sql theme={null}
GEOMETRY ST_GeomFromWKB(VARBINARY wkb, VARCHAR crs)
```

`crs` 必须是非空字符串字面量。没有默认 CRS，也不会执行隐式坐标转换或重投影。支持两种 WKB 字节序、全部七种二维 OGC 几何类型、`EMPTY` 和空子元素。不支持 EWKB 和 Z/M 坐标。无效 WKB 返回 `NULL`；WKB 为 `NULL` 时返回 `NULL`。

## 示例

```SQL theme={null}
SELECT ST_AsText(ST_GeomFromWKB(
    ST_AsBinary(ST_GeomFromText('POINT (1 2)', 'EPSG:3857')),
    'EPSG:3857'));
```

```text theme={null}
POINT (1 2)
```

## 关键字

ST\_GEOMFROMWKB, GEOMETRY, WKB, CRS

## 相关数据类型

[GEOMETRY](/documents/cn/4.2/sql-reference/data-types/spatial-types/GEOMETRY.md), [VARCHAR](/documents/cn/4.2/sql-reference/data-types/string-type/VARCHAR.md), [VARBINARY](/documents/cn/4.2/sql-reference/data-types/string-type/BINARY.md)


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