STUnion (geography Data Type)

Returns an object representing the union of a geography instance with another geography instance.

.STUnion ( other_geography )


Is another geography instance to form a union with the instance on which STUnion() is being invoked.

SQL Server return type: geography

CLR return type: SqlGeography

This method always returns null if the spatial reference identifiers (SRIDs) of the geography instances do not match.

The following example uses STUnion() to compute the union of two Polygon instances.

DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326);
SET @h = geography::STGeomFromText('POLYGON((-122.351 47.656, -122.341 47.656, -122.341 47.661, -122.351 47.661, -122.351 47.656))', 4326);
SELECT @g.STUnion(@h).ToString();

Community Additions