= PostGIS FAQ = Frequently Asked Questions about PostGIS extension. [[TOC(depth=2, noheading, inline)]] == PostgreSQL Can't install under Windows Vista == Refer to these instructions [UsersWikiWinVista Issues with installing under Windows Vista] == How to create geometry from hex-encoded Well-Known-Binary string using SQL? == This is two-steps operation which can be executed in single [http://www.postgresql.org/docs/8.3/static/sql-commands.html SQL] statement. The steps include: * Convert [http://postgis.refractions.net/documentation/manual-svn/ch04.html Well-Known-Binary] data in hexadecimal string form to raw binary using PostgreSQL function [http://www.postgresql.org/docs/8.3/static/functions-binarystring.html decode]. * Construct geometry object from WKB in raw binary form. Example: {{{ #!sql =# SELECT ST_AsText(ST_GeomFromWKB(decode('0101000000e5d022dbf93e2e40dbf97e6abc743540', 'hex'), -1)); st_astext ---------------------- POINT(15.123 21.456) }}} == How to write geometry Well-Known-Binary to hex-encoded string? == First, query for geometry object in [http://postgis.refractions.net/documentation/manual-svn/ch04.html Well-Known-Binary] format using [http://postgis.refractions.net/documentation/manual-svn/ST_AsBinary.html ST_AsBinary] function. Then, [http://www.postgresql.org/docs/8.3/static/functions-binarystring.html encode] raw WKB to hex string. Examples: * selecting geometry from table: {{{ #!sql # SELECT encode(ST_AsBinary(the_geom), 'hex'); encode -------------------------------------------- 0101000000e5d022dbf93e2e40dbf97e6abc743540 }}} * constructing geometry in-place from given Well-Known-Text: {{{ #!sql # SELECT encode(ST_AsBinary(ST_GeomFromText('POINT(15.123 21.456)', -1)), 'hex'); encode -------------------------------------------- 0101000000e5d022dbf93e2e40dbf97e6abc743540 }}}