# ST_ToPoint function

The ST_ToPoint function takes a geometry as an input parameter and converts it to a point. The resulting point is represented in the spatial reference system of the specified geometry.

The specified geometry must be empty or a point. If the specified geometry is null, then null is returned.

## Syntax

## Parameter

- geometry
- A value of type ST_Geometry or one of its subtypes that represents
the geometry that is converted to a point.
A geometry can be converted to a point if it is empty or a point. If the conversion cannot be performed, then an exception condition is raised (SQLSTATE 38SUD).

## Return type

ST_Point

## Example

This example creates three geometries
in SAMPLE_GEOMETRIES and converts each to a point.

```
CREATE TABLE sample_geometries (id INTEGER, geometry ST_Geometry)
INSERT INTO sample_geometries
VALUES (1, ST_Geometry ('point (30 40)', 1) ),
(2, ST_Geometry ('linestring empty', 1) ),
(3, ST_Geometry ('multipolygon empty', 1) )
```

In the following SELECT statement, the ST_ToPoint function
is used to return points converted to ST_Point from the static type
of ST_Geometry. ```
SELECT CAST( ST_AsText( ST_ToPoint(geometry) ) AS VARCHAR(35) ) POINTS
FROM sample_geometries
```

Results: ```
POINTS
---------------------------------
POINT (30.000000 40.000000)
POINT EMPTY
POINT EMPTY
```