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

# Legacy spatial function compatibility

> Existing functions and overloads that work with VARCHAR-encoded shapes.

The functions below support existing SQL that uses [VARCHAR](/documents/4.2/sql-reference/data-types/string-type/VARCHAR.md)-encoded shapes. `POINT`, `LINESTRING`, and `POLYGON` describe the shape within the encoding. Use [ST\_AsText](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md#legacy-overloads) to display it as Well-Known Text (WKT). For the 4.2 native types, see [Native spatial functions](/documents/4.2/sql-reference/sql-functions/spatial-functions/native-spatial-functions.md).

## Signatures

```sql theme={null}
VARCHAR ST_Point(DOUBLE x, DOUBLE y)
VARCHAR ST_Circle(DOUBLE center_lng, DOUBLE center_lat, DOUBLE radius)
VARCHAR ST_LineFromText(VARCHAR wkt)
VARCHAR ST_LineStringFromText(VARCHAR wkt)
VARCHAR ST_Polygon(VARCHAR wkt)
VARCHAR ST_PolyFromText(VARCHAR wkt)
VARCHAR ST_PolygonFromText(VARCHAR wkt)
VARCHAR ST_GeomFromText(VARCHAR wkt)
VARCHAR ST_GeometryFromText(VARCHAR wkt)
VARCHAR ST_AsText(VARCHAR shape)
VARCHAR ST_AsWKT(VARCHAR shape)
DOUBLE ST_X(VARCHAR point)
DOUBLE ST_Y(VARCHAR point)
BOOLEAN ST_Contains(VARCHAR shape1, VARCHAR shape2)
DOUBLE ST_Distance_Sphere(DOUBLE x_lng, DOUBLE x_lat, DOUBLE y_lng, DOUBLE y_lat)
```

## Example

```sql theme={null}
SELECT ST_AsText(ST_Point(24.7, 56.7)) AS point_wkt;
-- POINT (24.7 56.7)

SELECT ST_Contains(
    ST_Polygon('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'),
    ST_Point(5, 5)) AS contains_point;
-- true
```

## Function reference

* [ST\_Point](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_point.md)
* [ST\_Circle](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_circle.md)
* [ST\_LineFromText, ST\_LineStringFromText](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_linefromtext.md)
* [ST\_Polygon, ST\_PolyFromText, ST\_PolygonFromText](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_polygon.md)
* [ST\_GeomFromText, ST\_GeometryFromText](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_geometryfromtext.md#legacy-overloads)
* [ST\_AsText, ST\_AsWKT](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_astext.md#legacy-overloads)
* [ST\_X](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_x.md#legacy-overloads)
* [ST\_Y](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_y.md#legacy-overloads)
* [ST\_Contains](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_contains.md#legacy-overloads)
* [ST\_Distance\_Sphere](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_distance_sphere.md)


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