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

# ST_Polygon, ST_PolyFromText, ST_PolygonFromText

> 将 WKT（Well Known Text）转换为对应的多边形内存形式。

从 WKT 解析 `POLYGON`。

## 语法

```sql theme={null}
VARCHAR ST_Polygon(VARCHAR wkt)
VARCHAR ST_PolyFromText(VARCHAR wkt)
VARCHAR ST_PolygonFromText(VARCHAR wkt)
```

## 参数说明

`wkt`: 待转化的 WKT，支持的数据类型为 VARCHAR。

## 返回值说明

返回 `VARCHAR` 类型的旧版几何编码。使用 [ST\_AsText](/documents/cn/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) 可将其转换成可读的 WKT。

## 示例

```Plain Text theme={null}
MySQL > SELECT ST_AsText(ST_Polygon("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"));
+------------------------------------------------------------------+
| st_astext(st_polygon('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))')) |
+------------------------------------------------------------------+
| POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))                          |
+------------------------------------------------------------------+
```

## 相关数据类型

[VARCHAR](/documents/cn/4.2/sql-reference/data-types/string-type/VARCHAR.md)


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