Name

ST_LineFromWKB — Returns a LineString object given its Well-known text Representation

Synopsis

geometry ST_LineFromWKB(bytea WKB);

geometry ST_LineFromWKB(bytea WKB, integer SRID);

Alias

LineFromWKB, ST_LineStringFromWKB, LineStringFromWKB

Description

Creates a LineString from well-known binary representation of a LineString and a Spatial Reference System ID (SRID). If the SRID is not provides it defaults to -1. If WKB passed in is not a LINESTRING, then null is returned.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
3.2.7.27.2.7.1-7.2.9

Examples

SELECT ST_AsEWKT(ST_LineFromWKB(ST_GeomFromText('LINESTRING (0 0, 4 5, 10 10)')));
--Result
LINESTRING (0 0, 4 5, 10 10)

--EWKT From a LineString with SRID
SELECT ST_AsEWKT(ST_LineStringFromWKB(ST_GeomFromText('LINESTRING (0 0, 4 5, 10 10)'),25830));

--Result
SRID=25830;LINESTRING (0 0, 4 5, 10 10)

--WKB from a LineString and a Point
SELECT LineFromWKB(ST_GeomFromText('LINESTRING (0 0, 4 5, 10 10)'),25830) as line , ST_LineFromWKB(ST_GeomFromText('POINT (0 0)'),25830) as Point;

--Result
LINE          POINT  
010200002...  null

Related functions

ST_GeomFromWKB