STGeomCollFromWKB (geography Data Type)

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

Returns a GeometryCollectioninstance from an Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation.

Syntax

  
STGeomCollFromWKB ( 'WKB_geometrycollection' , SRID )  

Note

To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.

Arguments

WKB_geometrycollection
Is the WKB representation of the GeometryCollection instance you wish to return. WKB_geometrycollection is a varbinary(max) expression.

SRID
Is an int expression representing the spatial reference ID (SRID) of the GeometryCollection instance you wish to return.

Return Types

SQL Server return type: geography

CLR return type: SqlGeography

Remarks

The OGC type of the geography instance returned by STGeomCollFromWKB() is set to GeometryCollection, MultiPolygon, MultiLineString, or MultiPoint, depending on the corresponding WKB input.

This method throws a FormatException exception if the input is not well-formatted.

Examples

The following example uses STGeomCollFromWKB() to create a geography instance.

DECLARE @g geography;  
SET @g = geography::STGeomCollFromWKB(0x01070000000200000001010000007593180456965EC017D9CEF753D34740010200000002000000D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC08716D9CEF7D34740, 4326);  
SELECT @g.ToString();  

See Also

OGC Static Geography Methods