> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_Intersects

Given two shapes *A* and *B*, `ST_Intersects(A, B)` returns `true` if the shapes share any of the same space -- that is, if any point in the set that comprises *A* is also a member of the set of points that make up *B*.

`ST_Intersects` works on the following data types:

* [`GEOMETRY`](https://docs.cockroachlabs.com/docs/v24.2/architecture/glossary#geometry)
* [`GEOGRAPHY`](https://docs.cockroachlabs.com/docs/v24.2/architecture/glossary#geography)

> [!NOTE]
>
> \`\` will attempt to use any available [spatial index](https://docs.cockroachlabs.com/docs/v24.2/spatial-indexes) to speed up its operation.  Use the prefixed variant `_` if you do not want any spatial indexes to be used.

> [!NOTE]
>
> This function is the inverse of [`ST_Disjoint`](https://docs.cockroachlabs.com/docs/v24.2/st_disjoint).

## Examples

> [!NOTE]
>
> The screenshots in these examples were generated using [geojson.io](http://geojson.io), but they are designed to showcase the shapes, not the map.  Representing `GEOMETRY` data in GeoJSON can lead to unexpected results if using geometries with [SRIDs](https://docs.cockroachlabs.com/docs/v24.2/architecture/glossary#srid) other than 4326 (as shown below).

### True

In this example, \`\` returns `true` because:

* The shapes share some of the same space -- that is, there are Points in the set that comprises Polygon *A* that are also members of Polygon *B*.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SELECT st_intersects(st_geomfromtext('SRID=4326;POLYGON((-87.906471 43.038902, -95.992775 36.153980, -75.704722 36.076944, -87.906471 43.038902))'), st_geomfromtext('SRID=4326;POLYGON((-84.191605 39.758949, -75.165222 39.952583, -78.878738 42.880230, -84.191605 39.758949))'));
```

```
 st_intersects
---------------
     true

(1 row)
```

![ST\_Intersects - true](https://mintcdn.com/cockroachlabs/bBD0UEapbn6fk8Rb/images/common/geospatial/st_intersects_true.png?fit=max\&auto=format\&n=bBD0UEapbn6fk8Rb\&q=85\&s=98177dea039cbb25e3af2f76c99dc9c6)

### False

In this example, \`\` returns `false` because:

* The shapes do not share any of the same space -- that is, there are no Points in the set that comprises Polygon *A* that are also members of Polygon *B*.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SELECT st_intersects(st_geomfromtext('SRID=4326;POLYGON((-87.906471 43.038902, -95.992775 36.153980, -75.704722 36.076944, -87.906471 43.038902))'), st_geomfromtext('SRID=4326;POLYGON((-79.995888 40.440624,-74.666728 40.358244, -76.5 42.443333, -79.995888 40.440624))'));
```

```
 st_intersects
---------------
     false
(1 row)
```

![ST\_Intersects - false](https://mintcdn.com/cockroachlabs/bBD0UEapbn6fk8Rb/images/common/geospatial/st_intersects_false.png?fit=max\&auto=format\&n=bBD0UEapbn6fk8Rb\&q=85\&s=42be2a596ebabc2c4fb249018750c815)

## See also

* [Export Spatial Data](https://docs.cockroachlabs.com/docs/v24.2/export-spatial-data)
* [Spatial tutorial](https://docs.cockroachlabs.com/docs/v24.2/spatial-tutorial)
* [Spatial and GIS Glossary of Terms](https://docs.cockroachlabs.com/docs/v24.2/architecture/glossary)
* [Spatial indexes](https://docs.cockroachlabs.com/docs/v24.2/spatial-indexes)
* [Spatial functions](https://docs.cockroachlabs.com/docs/v24.2/functions-and-operators#spatial-functions)
* [`ST_Covers`](https://docs.cockroachlabs.com/docs/v24.2/st_covers)
* [`ST_CoveredBy`](https://docs.cockroachlabs.com/docs/v24.2/st_coveredby)
* [`ST_Contains`](https://docs.cockroachlabs.com/docs/v24.2/st_contains)
* [`ST_Within`](https://docs.cockroachlabs.com/docs/v24.2/st_within)
* [`ST_CoveredBy`](https://docs.cockroachlabs.com/docs/v24.2/st_coveredby)
* [`ST_Covers`](https://docs.cockroachlabs.com/docs/v24.2/st_covers)
* [`ST_Disjoint`](https://docs.cockroachlabs.com/docs/v24.2/st_disjoint)
* [`ST_Equals`](https://docs.cockroachlabs.com/docs/v24.2/st_equals)
* [`ST_Overlaps`](https://docs.cockroachlabs.com/docs/v24.2/st_overlaps)
* [`ST_Touches`](https://docs.cockroachlabs.com/docs/v24.2/st_touches)
* [`ST_ConvexHull`](https://docs.cockroachlabs.com/docs/v24.2/st_convexhull)
* [`ST_Union`](https://docs.cockroachlabs.com/docs/v24.2/st_union)
* [Migrate from Shapefiles](https://docs.cockroachlabs.com/docs/v24.2/migrate-from-shapefiles)
* [Migrate from GeoJSON](https://docs.cockroachlabs.com/docs/v24.2/migrate-from-geojson)
* [Migrate from GeoPackage](https://docs.cockroachlabs.com/docs/v24.2/migrate-from-geopackage)
* [Migrate from OpenStreetMap](https://docs.cockroachlabs.com/docs/v24.2/migrate-from-openstreetmap)
* [Introducing Distributed Spatial Data in CockroachDB](https://www.cockroachlabs.com/blog/spatial-data/) (blog post)
* [Using GeoServer with CockroachDB](https://docs.cockroachlabs.com/docs/v24.2/geoserver)
