Skip to content

ST_LineStringFromWKB

Constructs a LineString from Well-Known Binary (WKB), returning NULL if the input is another geometry type.

Usage

geometry ST_LineStringFromWKB(wkb: binary)
geometry ST_LineStringFromWKB(wkb: binary, srid: crs)

Arguments

  • wkb (binary)
  • srid (crs)

Description

Parses a WKB binary value and returns a LineString geometry. Returns NULL if the WKB represents another geometry type. An optional SRID or CRS can be provided as a second argument.

Alias: ST_LineFromWKB.

Examples

SELECT ST_LineStringFromWKB(
  decode('01020000000200000000000000000000000000000000000000000000000000F03F000000000000F03F', 'hex')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_linestringfromwkb(decode(Utf8("010200000002000000000000000000000000000000 │
│           00000000000000000000F03F000000000000F03F"),Utf8("hex")))…          │
╞══════════════════════════════════════════════════════════════════════════════╡
│ LINESTRING(0 0,1 1)                                                          │
└──────────────────────────────────────────────────────────────────────────────┘

With an SRID or CRS:

SELECT ST_LineStringFromWKB(
  decode('01020000000200000000000000000000000000000000000000000000000000F03F000000000000F03F', 'hex'),
  4326
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_linestringfromwkb(decode(Utf8("010200000002000000000000000000000000000000 │
│     00000000000000000000F03F000000000000F03F"),Utf8("hex")),Int64(4326))…    │
╞══════════════════════════════════════════════════════════════════════════════╡
│ LINESTRING(0 0,1 1)                                                          │
└──────────────────────────────────────────────────────────────────────────────┘