Share via


STUnion (geography Data Type)

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

Syntax

.STUnion ( other_geography )

Arguments

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

Return Types

SQL Server return type: geography

CLR return type: SqlGeography

Remarks

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

Examples

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();

See Also

Other Resources