wiki:FAQ

Version 3 (modified by mloskot, 16 years ago) ( diff )

--

PostGIS FAQ

Frequently Asked Questions about PostGIS extension.

How to create geometry from hex-encoded WKB using SQL?

This is two-steps operation which can be executed in single SQL statement. The steps include:

  1. Convert WKB data in hexadecimal form to raw binary using PostgreSQL function decode.
  2. Construct geometry object from WKB in raw binary form.

Example:

=# SELECT ST_AsText(ST_GeomFromWKB(decode('0101000000e5d022dbf93e2e40dbf97e6abc743540', 'hex'), 4326));
      st_astext       
----------------------
 POINT(15.123 21.456)
Note: See TracWiki for help on using the wiki.