我是一位长期以来的GIS人员,但最近一直在SQL Server的空间方面工作。我使用的是SQL Server 2016 Express。
我希望获得多边形的质心,这是这三个圆圈的交点。交叉口应该是一个非常小的多边形(30英尺左右)。但是,我的交叉点会创建一个巨大的多边形。
显然我做错了什么。这不是交叉点的工作方式吗?
CREATE TABLE #myTable
(
[Latitude] dec(15,10),
[Longitude] dec(15,10),
Dist dec(15,10),
ID varchar(4),
myGeog geography,
MyBuff geography
)
INSERT INTO #myTable
VALUES (36.808838, -119.792923, 347.2867998,'zX0', NULL,NULL),
(36.145789, -120.359316, 388.3265656,'zX1', NULL,NULL),
(31.333473, -110.867344, 1351.14404,'zX2', NULL,NULL)
UPDATE mt
SET myGeog = geography::Point(Latitude, Longitude, 4326)
FROM #myTable mt
UPDATE mt
SET MyBuff = myGeog.STBuffer(Dist*1000)
FROM #myTable mt
DECLARE @myB1 geography
DECLARE @myB2 geography
DECLARE @myB3 geography
SET @myB1 = (SELECT MyBuff FROM #myTable WHERE ID = 'zX0')
SET @myB2 = (SELECT MyBuff FROM #myTable WHERE ID = 'zX1')
SET @myB3 = (SELECT MyBuff FROM #myTable WHERE ID = 'zX2')
SELECT @myB1.STIntersection(@myB2.STIntersection(@myB3))
SELECT @myB1.STIntersection(@myB2.STIntersection(@myB3)).ToString()
DROP TABLE #myTable
答案 0 :(得分:0)
你的结果是对的。如果您只是运行:
SELECT MyBuff FROM #myTable;
看看它绘制在一起的3个多边形和交叉点的结果,你会发现它确实是交集。我认为它可能只是放大并夸大交叉点结果的比例。