是否有功能类似于 STUnion() 的聚合函数?

Is there an Aggregate function that functions similarly to STUnion()?

我看到有一个叫做 STUnion() 的东西可以将一种地理类型的结果与另一种地理类型的结果结合起来。但是是否可以像聚合函数那样对整个数据集执行此操作?

或者如果没有,是否有等效的性能?

SQL 服务器提供了一些 aggregate methods on geometries,包括 UnionAggregate 和 CollectionAggregate,它们对 2 个以上的形状进行操作。

来自 UnionAggregate 示例:

-- Setup table variable for UnionAggregate example 
DECLARE @Geom TABLE 
( 
shape geometry, 
shapeType nvarchar(50) 
);
 
INSERT INTO @Geom(shape,shapeType) 
VALUES
('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'), 
('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle'); 

-- Perform UnionAggregate on @Geom.shape column 
SELECT geometry::UnionAggregate(shape).ToString() 
FROM @Geom;

这会产生

CURVEPOLYGON (COMPOUNDCURVE (
  (1 1, 4 1, 4.0000000000000071 1.0000000000000218), 
  CIRCULARSTRING (4.0000000000000071 1.0000000000000218, 
    5.4142135623730905 1.5857864376269268,
    6 3, 
    5.4142135623730905 4.4142135623730905, 
    4.0000000000000071 4.9999999999999947), 
  (4.0000000000000071 4.9999999999999947, 1 5, 1 1))
)