Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Returns the input GEOGRAPHY
or GEOMETRY
value in WKB format using the specified endianness, if provided.
If the endianness is not specified, the returned value is little-endian encoded.
Syntax
st_aswkb ( geoExpr[, endiannessExpr] )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value.endiannessExpr
: An optionalSTRING
value, representing the endianness of the output WKB,'NDR'
for little-endian (default) or'XDR'
for big-endian.
Returns
A value of type BINARY
.
The returned value is the WKB description of the input GEOGRAPHY
or GEOMETRY
value using the specified endianness, if provided.
If the endianness is not specified, the returned value is little-endian encoded.
The function returns NULL
if any of the inputs is NULL
.
Examples
-- Export a 3DZ Cartesian point in WKB format (default endianness).
> SELECT hex(st_aswkb(st_geomfromtext('POINT Z (1 2 100)')))
01E9030000000000000000F03F00000000000000400000000000005940
-- Export a 3DZ geographic point in big -endianness WKB format.
> SELECT hex(st_aswkb(st_geogfromtext('POINT Z (1 2 100)'), 'XDR'))
00000003E93FF000000000000040000000000000004059000000000000
Related functions
st_asewkb
functionst_asgeojson
functionst_asewkt
functionst_astext
functionst_aswkt
functionst_geogfromgeojson
functionst_geogfromtext
functionst_geogfromwkb
functionst_geogfromwkt
functionst_geomfromewkb
functionst_geomfromgeojson
functionst_geomfromtext
functionst_geomfromwkb
functionst_geomfromwkt
functionto_geography
functionto_geometry
functiontry_to_geography
functiontry_to_geometry
function