---
title: st_force2d function
description: Learn the syntax of the st\_force2d function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_force2d
---

# `st_force2d` function

**Applies to:** ![check marked yes](https://docs.databricks.com/gcp/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/gcp/en/images/icons/check.png) Databricks Runtime 18.1 and above ![check marked yes](https://docs.databricks.com/gcp/en/images/icons/check.png) Lakehouse//RT

> [!NOTE]
> **Preview**
>
> Support for GEOGRAPHY values is in [Public Preview](https://docs.databricks.com/gcp/en/release-notes/release-types.md). Support for GEOMETRY values is [generally available](https://docs.databricks.com/gcp/en/release-notes/release-types.md).

> [!NOTE]
>
> This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see [SQL warehouse types](https://docs.databricks.com/gcp/en/compute/sql-warehouse/warehouse-types.md).

Returns the 2D projection of the input `GEOGRAPHY` or `GEOMETRY` value.

## Syntax

```
st_force2d ( geoExpr )
```

## Arguments

* `geoExpr`: A `GEOGRAPHY` or `GEOMETRY` value.

## Returns

A value of type `GEOGRAPHY` or `GEOMETRY`, representing the 2D projection of the input value.

The SRID value of the output `GEOGRAPHY` or `GEOMETRY` value is equal to that of the input value.

The function returns `NULL` if the input is `NULL`.

## Notes

If the input has Z or M coordinates, these are excluded in the output.

If the input is already 2D, the function returns it unchanged.

## Examples

```sql
-- Drops the M coordinate from a point geography.
> SELECT st_astext(st_force2d(st_geogfromtext('POINT M (1 2 3)')));
  POINT(1 2)
-- Drops Z and M coordinates from a multipoint geography.
> SELECT st_astext(st_force2d(st_geogfromtext('MULTIPOINT ZM (EMPTY,0 0 10 20, 1 1 11 21)')));
  MULTIPOINT(EMPTY,(0 0),(1 1))
-- Drops the Z coordinate from a polygon geography.
> SELECT st_astext(st_force2d(st_geogfromtext('POLYGON Z ((0 0 2,1 0 3,0 1 4,0 0 5))')));
  POLYGON((0 0,1 0,0 1,0 0))
-- Drops the Z coordinate from a point geometry.
> SELECT st_astext(st_force2d(st_geomfromtext('POINT Z (1 2 3)')));
  POINT(1 2)
-- Drops Z and M coordinates from a linestring geometry.
> SELECT st_astext(st_force2d(st_geomfromtext('LINESTRING ZM (0 0 10 20, 1 1 11 21)')));
  LINESTRING(0 0,1 1)
-- Returns the input 2D geometry as is.
> SELECT st_astext(st_force2d(st_geomfromtext('POINT(1 2)')));
  POINT(1 2)
-- Preserves the SRID of the input geography.
> SELECT st_srid(st_force2d(st_geogfromtext('POINT(1 2)')));
  4326
-- Preserves the SRID of the input geometry.
> SELECT st_srid(st_force2d(st_geomfromtext('POINT(1 2)', 4326)));
  4326
-- Returns NULL if the input is NULL.
> SELECT st_force2d(NULL);
   NULL
```

## Related functions

* [`st_ndims` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_ndims.md)
