Skip to content

ST_PointFromWKB

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

Usage

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

Arguments

  • wkb (binary)
  • srid (crs)

Description

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

Examples

SELECT ST_PointFromWKB(
  decode('0101000000000000000000F03F0000000000000040', 'hex')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_pointfromwkb(decode(Utf8("0101000000000000000000F03F0000000000000040"),Ut │
│                                 f8("hex")))…                                 │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2)                                                                   │
└──────────────────────────────────────────────────────────────────────────────┘

With an SRID or CRS:

SELECT ST_PointFromWKB(
  decode('0101000000000000000000F03F0000000000000040', 'hex'),
  4326
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_pointfromwkb(decode(Utf8("0101000000000000000000F03F0000000000000040"),Ut │
│                           f8("hex")),Int64(4326))…                           │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2)                                                                   │
└──────────────────────────────────────────────────────────────────────────────┘