Name

ST_GeomFromEWKB — Return a specified Geometry from a Extended Well-Known Binary representation (EWKB)

Synopsis

geometry ST_GeomFromEWKB(bytea EWKB);

Alias

GeomFromEWKB

Description

Return a specified Geometry from a Extended Well-Known Binary representation (EWKB). The EWKB format is a Postgis format that adds the Spatial Reference ID (SRID) to the OGC Well-Known Binary representation (WKB).

[Note]

The reverse function is ST_AsEWKB

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

PostgreSQL
--Get the EWKB
SELECT ST_AsEWKB(ST_GeomFromText('POINT(5 5)',25830));
st_asewkb                          
------------------------------------------------------------------------------------------
 \001\001\000\000 \346d\000\000\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@
(1 row)

--By default, in PostgreSQL we need to add double slashes to the WKB, and use E'' 
SELECT ST_GeomFromEWKB(E'\\001\\001\\000\\000 \\346d\\000\\000\\000\\000\\000\\000\\000\\000\\024@\\000\\000\\000\\000\\000\\000\\024@');

--By setting the value "standard_conforming_strings" to on, we can use exactly the AsEWKB representation
SET standard_conforming_strings = On;
SELECT st_asewkt(ST_GeomFromEWKB('\001\001\000\000 \346d\000\000\000\000\000\000\000\000\024@\000\000\000\000\000\000\024@'));
H2
--Get the EWKB
SELECT ST_AsEWKB(ST_GeomFromText('POINT(5 5)',25830));

0101000020e664000000000000000014400000000000001440

--Return the Geometry
SELECT ST_GeomFromEWKB('0101000020e664000000000000000014400000000000001440');

092080e66400000100000000000014400000000000001440

--As EWKT
SELECT ST_AsEWKT(ST_GeomFromEWKB('092080e66400000100000000000014400000000000001440'));

SRID=25830;POINT (5 5)

Related functions

ST_AsEWKB