ST_LineFromWKB — Returns a LineString object given its Well-known text Representation
geometry ST_LineFromWKB(bytea WKB);
geometry ST_LineFromWKB(bytea WKB, integer
SRID);
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.
| 2D | 3D | M |
|---|---|---|
![]() | ![]() | ![]() |
| 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.2 | 7.2.7.1 | - | 7.2.9 |
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