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

Forces the geometry into a 3-dimensional model so that all output representations will have X, Y and Z coordinates.
An optionally given zValue is tacked onto the geometry if the geometry is 2-dimensional. Default value of zValue is 0.0
If the given geometry is 3-dimensional, no change is performed on it.
If the given geometry is empty, no change is performed on it.

<Note>
  Example output is after calling ST\_AsText() on returned geometry, which adds Z for in the WKT for 3D geometries
</Note>

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

## Signatures

```sql theme={"system"}
ST_Force3D(geometry: Geometry, zValue: Double)
```

## Parameters

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

<ParamField body="zValue" type="Double" required>
  The Z coordinate value to assign. Defaults to `0.0` if not specified.
</ParamField>

## Return type

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

## Examples

```sql theme={"system"}
SELECT ST_AsText(ST_Force3D(ST_GeomFromText('POLYGON((0 0 2,0 5 2,5 0 2,0 0 2),(1 1 2,3 1 2,1 3 2,1 1 2))'), 2.3))
```

```
POLYGON Z((0 0 2, 0 5 2, 5 0 2, 0 0 2), (1 1 2, 3 1 2, 1 3 2, 1 1 2))
```

```sql theme={"system"}
SELECT ST_AsText(ST_Force3D(ST_GeomFromText('LINESTRING(0 1,1 0,2 0)'), 2.3))
```

```
LINESTRING Z(0 1 2.3, 1 0 2.3, 2 0 2.3)
```

```sql theme={"system"}
SELECT ST_AsText(ST_Force3D(ST_GeomFromText('LINESTRING EMPTY'), 3))
```

```
LINESTRING EMPTY
```
