EnvelopeAggregate (geometry Data Type)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2012) ![yes](media/yes.png)Azure SQL Database ![no](media/no.png)Azure SQL Data Warehouse ![no](media/no.png)Parallel Data Warehouse

Returns a bounding box for a given set of geometry objects.

Syntax

  
EnvelopeAggregate ( geometry_operand )  

Arguments

geometry_operand
Is a geometry type table column that represents the set of geometry objects.

Return Types

SQL Server return type: geometry

Exceptions

Throws a FormatException when there are input values that are not valid. See STIsValid (geometry Data Type)

Remarks

Method returns null when the input is empty or the input has different SRIDs. See Spatial Reference Identifiers (SRIDs)

Method ignores null inputs.

[!NOTE]
Method returns null if all inputted values are null.

Examples

The following example returns a bounding box for a set of objects in a table variable column.

-- Setup table variable for EnvelopeAggregate 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 EnvelopeAggregate on @Geom.shape column 
SELECT geometry::EnvelopeAggregate(shape).ToString() 
FROM @Geom;

See Also

Extended Static Geometry Methods