CollectionAggregate(geometry 数据类型)

通过一组 geometry 类型创建 GeometryCollection 实例。

语法

CollectionAggregate ( geometry_operand )

参数

  • geometry_operand
    一个 geometry 类型的表列,它表示要在 GeometryCollection 实例中列出的一组 geometry 对象。

返回类型

SQL Server 返回类型:geometry

异常

在输入值无效时引发 FormatException。 请参阅 STIsValid(geometry 数据类型)

注释

在输入为空或具有不同的 SRID 时,方法返回 null。 请参阅空间引用标识符 (SRID)

方法忽略 null 输入。

注意注意

如果所有输入值均为 null,则方法返回 null。

示例

以下示例返回一个包含 CurvePolygon 和 Polygon 的 GeometryCollection 实例。

-- Setup table variable for CollectionAggregate 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 CollectionAggregate on @Geom.shape column

SELECT geometry::CollectionAggregate(shape).ToString()

FROM @Geom;

请参阅

其他资源

扩展静态几何图形方法