ST_GeomFromWKB

更新时间:
复制 MD 格式

Constructs a geometry object from a Well-Known Binary (WKB) value and an optional spatial reference identifier (SRID).

Syntax

geometry ST_GeomFromWKB(bytea geom);
geometry ST_GeomFromWKB(bytea geom, integer srid);

Parameters

ParameterTypeDescription
geombyteaThe WKB-encoded binary representation of the geometry.
sridintegerThe spatial reference identifier (SRID) to assign to the geometry. If omitted, defaults to 0.

Usage notes

  • Supports circular strings and curves.

Example

Convert a WKB value to its Well-Known Text (WKT) representation:

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

Output:

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