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

Return the intersection geometry of A and B

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

## Signatures

```sql theme={"system"}
ST_Intersection (A: Geometry, B: Geometry)
```

## Parameters

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

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

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

<Note>
  If you encounter a `TopologyException` with the message "found non-noded intersection", try enabling the OverlayNG algorithm by setting the following Spark configuration:

  ```
  spark.driver.extraJavaOptions=-Djts.overlay=ng
  spark.executor.extraJavaOptions=-Djts.overlay=ng
  ```

  The OverlayNG algorithm is more robust than the legacy overlay implementation in JTS and handles many edge cases that would otherwise cause errors.
</Note>

## Example

```sql theme={"system"}
SELECT ST_Intersection(
    ST_GeomFromWKT("POLYGON((1 1, 8 1, 8 8, 1 8, 1 1))"),
    ST_GeomFromWKT("POLYGON((2 2, 9 2, 9 9, 2 9, 2 2))")
    )
```

```
POLYGON ((2 8, 8 8, 8 2, 2 2, 2 8))
```
