Export (0) Print
Expand All

STGeomCollFromWKB (geometry Data Type)

Returns a geometry collection instance 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 )

WKB_geometrycollection

Is the WKB representation of the geometry collection 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 geometry instance you wish to return.

SQL Server return type: geometry

CLR return type: SqlGeometry

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

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

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

DECLARE @g geometry;
SET @g = geometry::STGeomCollFromWKB(0x0107000000020000000103000000010000000400000000000000000014400000000000001440000000000000244000000000000014400000000000002440000000000000244000000000000014400000000000001440010100000000000000000024400000000000002440, 0);
SELECT @g.STAsText();

Community Additions

ADD
Show:
© 2014 Microsoft