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

Forces the geometry into XYM mode. Retains any existing M coordinate, but removes the Z coordinate if present. Assigns a default M value of 0.0 if `mValue` is not specified.

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

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

## Signatures

```sql theme={"system"}
ST_Force3DM(geometry: Geometry, mValue: Double = 0.0)
```

## Parameters

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

<ParamField body="mValue" type="Double" required default="0.0">
  The M (measure) 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_Force3DM(ST_GeomFromText('POLYGON M((0 0 3,0 5 3,5 0 3,0 0 3),(1 1 3,3 1 3,1 3 3,1 1 3))'), 2.3))
```

```
POLYGON M((0 0 3, 0 5 3, 5 0 3, 0 0 3), (1 1 3, 3 1 3, 1 3 3, 1 1 3))
```

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

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

```sql theme={"system"}
SELECT ST_AsText(ST_Force3DM(ST_GeomFromText('LINESTRING Z(0 1 3,1 0 3,2 0 3)'), 5))
```

```
LINESTRING M(0 1 5, 1 0 5, 2 0 5)
```
