> ## 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

> Converts a WKT (Well Known Text) to a corresponding polygon memory form.

Parses a `POLYGON` from Well-Known Text (WKT).

## Syntax

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

## Return value

Returns the legacy encoded shape as `VARCHAR`. Use [ST\_AsText](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md) to display it as WKT.

## Examples

```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))                          |
+------------------------------------------------------------------+
```

## keyword

ST\_POLYGON,ST\_POLYFROMTEXT,ST\_POLYGONFROMTEXT,ST,POLYGON,POLYFROMTEXT,POLYGONFROMTEXT

## Related data types

[VARCHAR](/documents/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.