ST_AsHEXEWKB

更新时间:
复制 MD 格式

Returns a geometry as a HEXEWKB string (as text) using either little-endian (NDR) or big-endian (XDR) encoding.

Syntax

text ST_AsHEXEWKB(geometry g1, text NDRorXDR);
text ST_AsHEXEWKB(geometry g1);

Parameters

ParameterDescription
g1The geometry object to serialize.
NDRorXDRThe byte order. Valid values: NDR (little-endian) and XDR (big-endian). If omitted, NDR is used.

Description

  • Supports circular strings and curves.

  • Supports 3D geometry and retains the Z coordinate.

  • If no encoding is specified, NDR (little-endian) is used by default.

Examples

SELECT ST_AsHEXEWKB(ST_GeomFromText('POLYGON((1 1,1 2,2 2,2 1,1 1))',4326));

Output:

                         st_ashexewkb
---------------------------------------------------------------
 0103000020E61000000100000005000000000000000000F03F00000000000.
.0F03F000000000000F03F0000000000000040000000000000004000000000.
.000000400000000000000040000000000000F03F000000000000F03F00000.
.0000000F03F
(1 row)