Skip to main content

ST_INTERSECTION

Introduced or updated: v1.2.895

Returns the shared part of two GEOMETRY objects.

This function only supports GEOMETRY values.

Syntax

ST_INTERSECTION(<geometry1>, <geometry2>)

Arguments

ArgumentsDescription
<geometry1>The argument must be an expression of type GEOMETRY.
<geometry2>The argument must be an expression of type GEOMETRY.
note
  • The function reports an error if the two input GEOMETRY objects have different SRIDs.

Return Type

GEOMETRY.

Examples

SELECT ST_ASWKT(ST_INTERSECTION(TO_GEOMETRY('LINESTRING(0 0, 1 1)'), TO_GEOMETRY('LINESTRING(0 0, 1 1)')));

╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ st_aswkt(st_intersection(to_geometry('LINESTRING(0 0, 1 1)'), to_geometry('LINESTRING(0 0, 1 1)')))
├─────────────────────────────────────────────────────────────────────────────────────────────────────┤
LINESTRING(0 0,1 1)
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today