ST_ASWKB()

All functions > GEOSPATIAL > ST_ASWKB()

Returns the WKB (Well Known Binary) representation of a geometry or geography.

Signatures

To WKB

Returns: WKB byte string

ST_ASWKB(geo: T) → BINARY
sql
ParameterTypeRequiredDescription
geoTYesGeometry or geography value

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY

Signature notes:

  • Accepts any sub kind
  • Works on both GEOMETRY and GEOGRAPHY values
  • On Trino: transpiled to ST_AsBinary
  • On BigQuery: no native WKB export; transpiled to ST_ASGEOJSON (returns VARCHAR, not BINARY)
  • Returns NULL if the input is NULL
Last update at: 2026/05/26 17:22:09