SQL Server geometry: intersection of multiple polygons
geometry, polygon, spatial, sql-server
Solution
I'm not somewhere that I can test this right now, but if spatial aggregates work like other aggregates (i.e. string + string), let's try this:
declare @intersection geometry;
select top 1 @intersection = border
from #polygons;
select @intersection = border.STIntersects(@intersection)
from #polygons;
select @intersection.STIsEmpty();
If I've done my work correctly, @intersection should contain the intersection of all of the polygons in the table.
Problem
I have multiple polygons in a table (`ImageId int, Quality float, Border geometry`). How can I find all intersects of polygons using T-SQL functions with more high performance? Is there are any function which help to find intersections without iteration and without comparison each polygon with each Or any sample how to do it. Can anyone help me?