Skip to content

ST_GeomFromWKB

Constructs a Geometry from Well-Known Binary (WKB).

Usage

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

Arguments

  • wkb (binary)
  • srid (crs)

Description

Parses a WKB binary value and returns a geometry. The input is validated by default. An optional SRID or CRS can be provided as a second argument.

Examples

SELECT ST_GeomFromWKB(
  decode('0101000000000000000000F03F0000000000000040', 'hex')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_geomfromwkb(decode(Utf8("0101000000000000000000F03F0000000000000040"),Utf │
│                                  8("hex")))…                                 │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2)                                                                   │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_GeomFromWKB(
  decode('0101000000000000000000F03F0000000000000040', 'hex'),
  4326
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_geomfromwkb(decode(Utf8("0101000000000000000000F03F0000000000000040"),Utf │
│                            8("hex")),Int64(4326))…                           │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2)                                                                   │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_GeomFromWKB(
  decode('0101000000000000000000F03F0000000000000040', 'hex'),
  'OGC:CRS27'
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_geomfromwkb(decode(Utf8("0101000000000000000000F03F0000000000000040"),Utf │
│                         8("hex")),Utf8("OGC:CRS27"))…                        │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2)                                                                   │
└──────────────────────────────────────────────────────────────────────────────┘