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

# ST_AddPoint

RETURN Linestring with additional point at the given index, if position is not available the point will be added at the end of line.

<img src="https://mintcdn.com/wherobots/AayJA2u8CknIeTgt/images/sql-functions/ST_AddPoint/ST_AddPoint.svg?fit=max&auto=format&n=AayJA2u8CknIeTgt&q=85&s=446d499f75eb37928ff5e5fc428b7aa3" alt="ST_AddPoint" width="500" height="300" data-path="images/sql-functions/ST_AddPoint/ST_AddPoint.svg" />

## Signatures

```sql theme={"system"}
ST_AddPoint(geom: Geometry, point: Geometry, position: Integer)
```

```sql theme={"system"}
ST_AddPoint(geom: Geometry, point: Geometry)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="point" type="Geometry" required>
  The point value.
</ParamField>

<ParamField body="position" type="Integer">
  The position value.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_AddPoint(ST_GeomFromText("LINESTRING(0 0, 1 1, 1 0)"), ST_GeomFromText("Point(21 52)"), 1)

SELECT ST_AddPoint(ST_GeomFromText("Linestring(0 0, 1 1, 1 0)"), ST_GeomFromText("Point(21 52)"))
```

```
LINESTRING(0 0, 21 52, 1 1, 1 0)
LINESTRING(0 0, 1 1, 1 0, 21 52)
```
