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

# `st_crosses` 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 cross each other.

## Syntax

```
st_crosses ( 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 cross each other.

Whether two geometries cross depends on their topological dimensions:

* If the geometries have different topological dimensions, they cross if their interiors intersect and part of the interior of the lower-dimensional geometry lies outside the higher-dimensional geometry.
* If both geometries are one-dimensional (linestrings or multilinestrings), they cross if their interiors intersect only at points.
* Otherwise, they do not cross. Two zero-dimensional geometries (points or multipoints) and two two-dimensional geometries (polygons or multipolygons) never cross.

The result does not depend on the order of the arguments.

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 *Crosses* 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 linestrings whose interiors intersect at a point.
> SELECT st_crosses(st_geomfromtext('LINESTRING(0 0,2 2,4 4)'),st_geomfromtext('LINESTRING(0 1,2 1,3 1)'));
  true
-- Returns true for a linestring that passes through the interior of a polygon and leaves it.
> SELECT st_crosses(st_geomfromtext('LINESTRING(0 0,10 10)'),st_geomfromtext('POLYGON((0 0,0 5,5 5,5 0,0 0))'));
  true
-- Returns false for a linestring that runs along the boundary of a polygon but never enters its interior.
> SELECT st_crosses(st_geomfromtext('LINESTRING(0 0,10 0)'),st_geomfromtext('POLYGON((0 0,0 5,5 5,5 0,0 0))'));
  false
-- Returns true for a multipoint with one point in the interior of a linestring and one point outside it.
> SELECT st_crosses(st_geomfromtext('MULTIPOINT(1 0,1 1)'),st_geomfromtext('LINESTRING(0 0,1 0,3 3)'));
  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_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_overlaps` function](https://docs.databricks.com/gcp/en/sql/language-manual/functions/st_overlaps.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)
