ST_LineFromWKB

更新时间:
复制 MD 格式

Constructs a LineString geometry object from a Well-Known Binary (WKB) value and an optional spatial reference identifier (SRID).

Syntax

geometry ST_LineFromWKB(bytea WKB);
geometry ST_LineFromWKB(bytea WKB, integer srid);

Parameters

ParameterTypeDescription
WKBbyteaThe WKB value to parse.
sridintegerThe SRID to assign to the geometry object. Defaults to 0 if omitted.

Return value

Returns a geometry object. Returns NULL if the WKB value does not represent a LineString.

Usage notes

If the WKB value is known to represent a LineString, use ST_GeomFromWKB instead. It is more efficient than ST_LineFromWKB.

Examples

SELECT ST_AsText(ST_LineFromWKB(E'\\x010200000002000000000000000000f03f000000000000004000000000000008400000000000001040'));

Output:

      st_astext
---------------------
 LINESTRING(1 2,3 4)
(1 row)