geography.STIntersection
spatial method STIntersection (instance.STIntersection(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- geography
- Return type
- SQL Server return type: geography CLR return type: SqlGeography
Syntax at a glance
.STIntersection ( other_geography )
Work example
Use geography.STIntersection to return the shared part of two shapes.
Check matching SRIDs and inspect empty or collection results. Confirm both values use the same SRID before comparing or combining them.
Check your work The intersecting polygons return their shared region; both have SRID 4326.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT a.shape.STIntersection(b.shape).STGeometryType() AS intersection_type, a.shape.STIntersection(b.shape).STAsText() AS intersection_wkt FROM (VALUES (geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326))) AS a(shape) CROSS JOIN (VALUES (geography::STGeomFromText('POLYGON((-122.351 47.656, -122.341 47.656, -122.341 47.661, -122.351 47.661, -122.351 47.656))', 4326))) AS b(shape);
Open Microsoft Learn for full syntax, permissions, and details for your version.