ST_GeomFromWKB

更新时间:
复制 MD 格式

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

Syntax

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

Parameters

ParameterDescription
geomThe WKB representation of the geometry, as a bytea value.
sridThe SRID of the geometry object. If omitted, defaults to 0.

Usage notes

  • If no SRID is specified, the function uses the default SRID 0.

  • This function supports circular strings and curves.

Examples

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

SELECT ST_AsText(ST_GeomFromWKB(E'\\x01010000000000000000005d400000000000004440'));
   st_astext
---------------
 POINT(116 40)
(1 row)