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

# `st_overlaps` 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 19 and above ![check marked yes](https://docs.databricks.com/gcp/en/images/icons/check.png) Lakehouse//RT

> [!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 true if the two input `GEOMETRY` values overlap each other.

## Syntax

```
st_overlaps ( geo1, geo2 )
```

## Arguments

* `geo1`: The first `GEOMETRY` value.
* `geo2`: The second `GEOMETRY` value.

## Returns

A value of type `BOOLEAN`, indicating whether the two input `GEOMETRY` values overlap each other.

Two geometries overlap if all of the following hold:

* They have the same topological dimension.
* The intersection of their interiors has that same topological dimension.
* Neither geometry covers the other.

Geometries of different topological dimensions never overlap.

The function returns `false` if any of the inputs is empty.

The function does not support geometry collections.

For more details and the formal definition, see the *Overlaps* predicate in the [DE-9IM matrix definition](https://en.wikipedia.org/wiki/DE-9IM#Spatial_predicates).

The function returns `NULL` if any of the inputs is `NULL`.

## Error conditions

* If any of the input geometries is a geometry collection, the function returns [ST\_INVALID\_ARGUMENT.INVALID\_TYPE](https://docs.databricks.com/gcp/en/error-messages/st-invalid-argument-error-class.md#invalid_type).
* If the input geometries do not have the same SRID value, the function returns [ST\_DIFFERENT\_SRID\_VALUES](https://docs.databricks.com/gcp/en/error-messages/error-classes.md#st_different_srid_values).

## Examples

```sql
-- Returns true for two polygons that share part of their interiors.
> SELECT st_overlaps(st_geomfromtext('POLYGON((0 0,0 5,5 5,5 0,0 0))'),st_geomfromtext('POLYGON((3 3,3 9,9 9,9 3,3 3))'));
  true
-- Returns false because the first polygon covers the second.
> SELECT st_overlaps(st_geomfromtext('POLYGON((0 0,0 5,5 5,5 0,0 0))'),st_geomfromtext('POLYGON((3 3,3 5,5 5,5 3,3 3))'));
  false
-- Returns true for two multipoints that share some, but not all, of their points.
> SELECT st_overlaps(st_geomfromtext('MULTIPOINT(0 0,1 1,2 2)'),st_geomfromtext('MULTIPOINT(1 1,3 3,4 4)'));
  true
```

## Related functions

* [`st_contains` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_contains.md)
* [`st_covers` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_covers.md)
* [`st_crosses` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_crosses.md)
* [`st_disjoint` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_disjoint.md)
* [`st_equals` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_equals.md)
* [`st_intersects` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_intersects.md)
* [`st_touches` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_touches.md)
* [`st_within` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_within.md)
