ST_GeomFromWKB

Determine a geometry from its Well-Known Binary (WKB) representation.

ST_GeomFromWKB is exactly the same as ST_WKBToSQL. ST_WKBToSQL does the reverse of ST_AsBinary.

Syntax

ST_GeomFromWKB(wkbgeo[, srid[, computeMBR]]);
wkbgeo
The input geometry in WKB format.

Type: VARCHAR(ANY)

srid
The spatial reference system identifier.

Type: INT4

Default: 4326

computeMBR
Whether to calculate the minimum bounding rectangle (MBR) of the input geometry.

Type: BOOL

Default: TRUE

Returns

A value of type VARCHAR(ANY) that contains a geometry.

Examples

SELECT inza..ST_AsText(inza..ST_GeomFromWKB(inza..ST_AsBinary(inza..ST_ WKTToSQL('POLYGON ((0 0, 11 0, 11 11, 0 11, 0 0))'))));

ST_ASTEXT
---------
POLYGON ((0 0, 11 0, 11 11, 0 11, 0 0))
(1 row)
SELECT inza..ST_AsText(inza..ST_GeomFromWKB(inza..ST_AsBinary(inza..ST_ WKTToSQL('LINESTRING(0
            0, 3 4, -1 1)'))));

ST_ASTEXT
---------
LINESTRING (0 0, 3 4, -1 1)
(1 row)
SELECT inza..ST_AsText(inza..ST_GeomFromWKB(inza..ST_AsBinary(inza..ST_ Point(1,
            5))));

ST_ASTEXT
---------
POINT (1 5)
(1 row)