Converting WKB to WKT – Complete Guide

convertwell-known-binarywell-known-text

How can I convert WKB to WKT form?

I stored coordinates in WKB but now I want to display it using WKT form.

Best Answer

If you want to use PostGIS to do the conversion, you can choose from the following functions:

bytea WKB = ST_AsBinary(geometry);
text WKT = ST_AsText(geometry);
geometry = ST_GeomFromWKB(bytea WKB, SRID);
geometry = ST_GeometryFromText(text WKT, SRID);

More: http://postgis.net/docs/manual-1.5/ch04.html#OpenGISWKBWKT

Related Question