我需要计算同一张表中多边形之间的重叠区域。理想情况下,我想为此使用 mssql 空间功能(类似于@a.SHAPe.STIntersections(@b.SHAPE).STArea())。
但我不知道如何对同一层中的多边形执行此操作。
谢谢!
房地美
我为你举了一个小例子,向你展示如何实现这一点。
SELECT
a.Geog1.STIntersection(b.Geog2) AS OverlapGeog
, a.Geog1.STIntersection(b.Geog2).STArea() AS AreaOverlap
FROM
(
SELECT
GEOGRAPHY::STGeomFromText('POINT(0.0 0.0)',4326).STBuffer(100) AS Geog1
) a
INNER JOIN
(
SELECT
GEOGRAPHY::STGeomFromText('POINT(0.001 0.0)',4326).STBuffer(100) AS Geog2
) b
On
a.Geog1.STIntersects(b.Geog2) = 1