STGeomCollFromWKB (geography Data Type)


Updated: June 10, 2016

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

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.
STGeomCollFromWKB ( 'WKB_geometrycollection' , SRID )  

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

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

SQL Server return type: geography

CLR return type: SqlGeography

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.

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

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

OGC Static Geography Methods

Community Additions