geography::STLineFromWKB
static constructor STLineFromWKB (called as type::STLineFromWKB(...))
What changes
- Input
- WKT, WKB, GML or coordinates and SRID
- Output or change
- spatial instance
- Return type
- SQL Server return type: geography CLR return type: SqlGeography OGC type: LineString
Syntax at a glance
STLineFromWKB ( 'WKB_linestring' , SRID )
Work example
Use geography.STLineFromWKB to construct a line from WKB bytes.
Confirm the payload represents a line and keep its SRID beside it. Keep the geography type and SRID in the review.
Check your work The WKB constructor returns a LineString; the SRID 4326 is passed explicitly.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT geography::STLineFromWKB(s.shape.STAsBinary(), 4326).STGeometryType() AS decoded_type FROM (VALUES (geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326))) AS s(shape);
Open Microsoft Learn for full syntax, permissions, and details for your version.