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
| Parameter | Description |
|---|---|
wkb | A 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
geographyobject from a Well-Known Text (WKT) or EWKT string.ST_AsBinary: Convert a
geometryorgeographyvalue back to WKB format.
该文章对您有帮助吗?