geography: Static Aggregate Geography Methods
none (documentation, rules or examples)
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
n/a (reference page)
Work example
Use geography methods for grouped collections, hulls, envelopes, and unions.
Group compatible SRIDs and retain source keys when each input must remain traceable.
Check your work All four SQL Server geography aggregates read the three SRID 4326 points and return named spatial results.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT geography::CollectionAggregate(v.shape).STNumGeometries() AS collected_count, geography::ConvexHullAggregate(v.shape).STGeometryType() AS hull_type, geography::EnvelopeAggregate(v.shape).STGeometryType() AS envelope_type, geography::UnionAggregate(v.shape).STGeometryType() AS union_type FROM (VALUES (geography::Point(47.653, -122.360, 4326)), (geography::Point(47.649, -122.348, 4326)), (geography::Point(47.658, -122.348, 4326))) AS v(shape);
Open Microsoft Learn for full syntax, permissions, and details for your version.