ST_GeogFromWKB

更新时间:
复制 MD 格式

Parses a Well-Known Binary (WKB) or Extended Well-Known Binary (EWKB) input and returns a geography value.

Syntax

geography ST_GeogFromWKB(bytea wkb);

Parameters

ParameterDescription
wkbA bytea value in WKB or EWKB format. In PostgreSQL, pass a binary literal using the escape syntax: E'\\x<hex>', where <hex> is the hexadecimal representation of the geometry without a leading 0x.

Usage notes

  • If no spatial reference identifier (SRID) is embedded in the input, the default SRID 4326 is used.

  • Supports circular strings and curves.

Examples

Convert a WKB-encoded point to its text representation:

SELECT ST_AsText(ST_GeogFromWKB(E'\\x01010000000000000000005d400000000000004440'));

Output:

   st_astext
---------------
 POINT(116 40)
(1 row)

What's next

  • ST_GeogFromText: Construct a geography object from a Well-Known Text (WKT) or EWKT string.

  • ST_AsBinary: Convert a geometry or geography value back to WKB format.